php-cgi does not give proper 404 errors

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.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *