No input file specified. Codeigniter & htaccess

I have few sites of clients running with Codeigniter and are hosted by different hosts including Godaddy, Host Gator and others. With few hosts I had problems with working of CI, whenever I tried to access the website, I just used to get a text in browser saying ‘No input file specified‘ and no html as expected except this text. After some practice I got the solution which is just to place an question mark in htaccess rewrite rule.

The htaccess file generally looks like the below for a Codeigniter installation:

The web application worked very well with above rules in my development environment but it generated the error “No Input File Specified” when I uploaded it to GoDaddy Web Hosting.

Fix to No Input File Specified

To get rid from no input file specified error and to let Codeigniter work smoothly, we need to add an question mark just after index.php in last rewrite rule:

This little change will correct no input fie specified installation issue with your host. Please note that:

  • The .htaccess file must be in Unix LF only style. If you use Notepad or Wordpad and upload an .htaccess file in CR/LF style it won’t work.
  • This htaccess file should be present in your Codeigniter installation root directory and at the same level at index.php

Please feel free to comment below. If you face any issue, we are here to solve those.

You Might Interested In

  • Sunil Tomar

    your code is working very fine

    .i used it in .htacces. thank you sir

  • You are a lifesaver.