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 AtulHost

Creator of AtulHost. An ardent Linux user. Comes from a business management background. Loves to do research on modern business insights and enterprise solutions like career, education, finance, investments ideas, marketing strategies, and productivity skills; technological trends like automation, artificial intelligence, cloud and edge computing, computer hardware and networking, data science, and the internet of things.

Join the discussion

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

Ensure a friendly atmosphere to our members and visitors. Encourage the freedom of expression and exchange of information. Comments that are off-topic will be deleted.