Fedora Core Linux Based HostingFedora Core Linux Based Hosting
RUS  
My mail   Search   Contacts


How to setup the arbitrary page of 404 error for *.php file?

I tried to setup 404 error page for my PHP-scripts, but instead of the page I always get an error saying "No input file specified".


Since PHP interpreter works as FastCGI, the directive

ErrorDocument 404 /customerrorpage.html

will not work for files with the extensions: .php .php3 .phtml .php4

Solution to this problem is simple; add the following code to your .htaccess file:

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