How to fix “No Input File Specified” error?

In a web server, let it be Apache or Nginx, if rewrite rules unable to touch the index file or root file, it shows an error of no input file specified.

To fix this error we just need to locate the root location or file.

For an instance, we have picked WordPress as a CMS which uses index.php file as it’s root file to serve the complete website.

Apache users can use the following code:

Below code must be added to the .htaccess file located in root directory.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Usually Apache fix this issue by itself unless their is any permission issue. In some cases you just need to delete (after backing up) .htaccess file and hard reload the front end one, the required settings will be added automatically.

Nginx users can use the following code:

Nginx is not like Apache, we need to manually add the required directives.

Just edit the configuration file of your website and modify these settings:

server {
... rest of the config ...
    index index.php;
    root /var/www/html;
... rest of the config ...
}

In some complex setups you need to modify location blocks too. Just check them.

Once you have saved the changes just reload or restart the Nginx.

That is it. You’ve fixed the no input file specified error.

Published by Atul Kumar Pandey

Hi, I'm creator of atulhost, comes from business management and tech background. I love to do research on modern business insights and latest technological solutions.

Leave a reply

Required fields are asterisked and email address will not be shared.