unclepauly Posted April 22, 2011 Share Posted April 22, 2011 hello, i really hope someone can help me here. i have written a custom 404.php page and i have set up my htaccess file to redirect all non-existing pages to this 404 page like so: ErrorDocument 404 /404.php everthing is working fine, APART FROM when i try to access a non existing PHP file in the ROOT directory only. for example : www. mydomain.co.uk/this_page_doesnt_exist.php this does not display my 404 page. IE just says 'this page cannot be displayed', FF is just blank, and Chrome is a bit more informative, it says 'this page is not available: Error 324 (net::ERR_EMPTY_RESPONSE): Unknown error.' HOWEVER if the non-existing page is inside a SUB DIRECTORY, for example: www. mydomain.co.uk/subdir/this_page_doesnt_exist.php then this is fine and my 404 page is displayed ! (whether the sub directory exists or not !) ALSO if the extension is HTML instead of php then this works too, for example: www. mydomain.co.uk/this_page_doesnt_exist.html then this is fine and my 404 page is displayed ! i am running php V5.2.6 and i am with FastHost so i dont have access to the server. phpinfo shows that the ServerAPI is CGI/FastCGI and if there is any more info you need i will gladly give it. i have used Fiddler and Wireshark to debug the HTTP traffic, and both show that no response is returned from the server. This would explain the problem but why is this happeniing ? i have trawled the net but found nothing relating to this. if you want to see the problem in action, please go to my web site, just replace 'mydomain' above with 'sabalex'. i am almost sure this is a bug ? can anyone confirm this? or tell me if i am doing something wrong ? very grateful for any help. Quote Link to comment https://forums.phpfreaks.com/topic/234424-help-errordocument-404-not-workingonly-for-php-pages-html-is-fine/ 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.