EllisLab text mark
Advanced Search
     
404 error page returns a status of 200 in the header
Posted: 28 August 2007 09:55 PM
Joined: 2007-07-29
4 posts

I’ve checked the headers on pages that are supposed to return a 404 error and they return “HTTP/1.1 404 Not Found”, which is the desired and expected behavior. However, for those familiar with Google Webmaster Tools, if I try to verify my site ownership for the Google Sitemaps application by uploading a file (e.g. google4a61g765e7b98d37.html) to the CodeIgniter root directory, Google gives me the following error:

Verification status: NOT VERIFIED
We’ve detected that your 404 (file not found) error page returns a status of 200 (Success) in the header.

Not sure if this is a bug or due to my own oversight or improper implementation of the show_404 function. Anyone have any ideas what’s causing this? Am I using the show_404 function incorrectly? I tried sticking the path into the function but Google gave me the same error, so right now I just call it like so:

show_404(); 

Any help would be greatly appreciated. Thanks!  smile

 
Posted: 28 August 2007 10:40 PM   [ # 1 ]   [ Rating: 0 ]
Joined: 2007-06-28
54 posts
Danilo Stern-Sapad - 29 August 2007 01:55 AM

Not sure if this is a bug or due to my own oversight or improper implementation of the show_404 function. Anyone have any ideas what’s causing this?

Looking in Exceptions.php, I don’t see anything about an actual 404 header…

 
Posted: 28 August 2007 11:35 PM   [ # 2 ]   [ Rating: 0 ]
Joined: 2007-07-29
4 posts

So do I need to explicitly specify:

header("HTTP/1.1 404 Not Found"); 
 
Posted: 29 August 2007 12:12 AM   [ # 3 ]   [ Rating: 0 ]
Joined: 2007-07-29
4 posts

I found the problem my permitted URL characters in my config.php file were too restrictive, so when Google saw my 404 pages it was getting the “The URI you submitted has disallowed characters.” message from the Router.php library file, which returns a 200 OK. I just changed my allowed URI characters back to the default and everything is fine.  grin