php-cgi does not give proper 404 errors

8 May, 2014 (13:38) | CGI, php | By: sblogadmin

When using php-cgi via .htaccess you will find that missing files give “No input file specified” instead of a proper 404 error.

To fix this, add :

 

RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteRule ^.+\.php$ /file_name_that_does_not_exist

to your .htaccess

replace “file_name_that_does_not_exist” with any file name that does not exist – ie. something that will trigger a 404 error.

 

 

Write a comment