Jump to content

404 headers don't work in Firefox


53329

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.