rtadams89 Posted June 16, 2008 Share Posted June 16, 2008 Here is the .htaccess I have placed in my root directory: CheckSpelling off AddType x-mapp-php5 .php RewriteEngine On RewriteCond %{HTTP_HOST} !www.asurfc.com RewriteRule ^.*$ http://www.asurfc.com%{REQUEST_URI} [R] ErrorDocument 404 http://www.asurfc.com/404.php If a visitor goes to "http://asurfc.com/nowhere.html" or "http://asurfc.com/nowhere/nowhere.php", my custom 404 page gets displayed as expected. But, if a visitor goes to "http://asurfc.com/nowhere.php", my web host's default 404 page gets displayed. It seems my custom 404 page works every time except if the non-existent requested file is a php file in the root directory. Can someone explain why this is happening? PS: My web host is 1&1. You can see the problem I have for yourself by visiting the URLs I mentioned above. Quote Link to comment Share on other sites More sharing options...
rtadams89 Posted June 16, 2008 Author Share Posted June 16, 2008 I added the following line to my .htaccess file: #Custom 404 for non existant .php files work around RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^[0-9a-zA-Z_/.-]+\.php$ http://www.asurfc.com/error.php?code=404 Everything now works as expected. Any reason the plain "errordocument" declaration wasn't working for non existent php files? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.