53329 Posted September 3, 2008 Share Posted September 3, 2008 Whenever I output 404 headers it shows a blank page in Firefox but my IE processes the 404 like normal. I'm not sure if its just Firefox, addons, or my code. Here are a few I tried... header("HTTP/1.0 404 Not Found"); header("Status: 404 Not Found"); header(' ', true, 404); All result in a blank page. I'm using firefox 3.0.1 and the only addons I have are Web Developer and StumleUpon so I doubt it that. I'm completely dumbfounded. Link to comment https://forums.phpfreaks.com/topic/122492-404-headers-dont-work-in-firefox/ Share on other sites More sharing options...
53329 Posted September 3, 2008 Author Share Posted September 3, 2008 Sorry to double post. IE will generate a 404 page now if its a URL that I haven't been to (even just changing get vars). Otherwise I can clear cache and get the same blank page as Firefox. Firefox to clarify seems to just ignore the 404 header completely. Link to comment https://forums.phpfreaks.com/topic/122492-404-headers-dont-work-in-firefox/#findComment-632498 Share on other sites More sharing options...
dis Posted September 5, 2008 Share Posted September 5, 2008 I find the exact same issue. However, I work around it. Best way, is to echo out a custom PHP file, for Firefox. If you want IE to show the same as Firefox, your file will need to be larger than 512 bytes. <?php header('HTTP/1.0 404 Not Found'); include(_DIR.'includes/404.php'); exit(); ?> <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>404 Not Found</title> </head><body> <h1>Not Found</h1> <p>The requested URL '<strong><?php echo $_SERVER['REQUEST_URI']; ?></strong>' was not found on this server.</p> </body></html> <!-- - Unfortunately, Microsoft has added a clever new - "feature" to Internet Explorer. If the text of - an error's message is "too small", specifically - less than 512 bytes, Internet Explorer returns - its own error message. You can turn that off, - but it's pretty tricky to find switch called - "smart error messages". That means, of course, - that short error messages are censored by default. - IIS always returns error messages that are long - enough to make Internet Explorer happy. The - workaround is pretty simple: pad the error - message with a big comment like this to push it - over the five hundred and twelve bytes minimum. - Of course, that's exactly what you're reading - right now. --> Link to comment https://forums.phpfreaks.com/topic/122492-404-headers-dont-work-in-firefox/#findComment-634314 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.