SEO Mistake To Avoid: Custom 404 Pages Which Return 200 Status Codes

by Darren McLaughlin

September 30, 2006 – 7:01 am

That’s right, readers. If you want to really screw the pooch on search engine rankings, especially in Google, I have a method which should really help. Many webmasters use custom 404 error documents to display their own special messages to visitors when a page can’t be displayed. That’s great, but can lead to one big problem if they’re not careful: the 404 page may return a 200 Status Code.

First, let’s define our terms and explain why this could be a big problem. Let’s look at what the W3C says about both codes:

The request has succeeded. The information returned with the response is dependent on the method used in the request, for example:

GET an entity corresponding to the requested resource is sent in the response;
HEAD the entity-header fields corresponding to the requested resource are sent in the response without any message-body;
POST an entity describing or containing the result of the action;
TRACE an entity containing the request message as received by the end server

Simple enough, the 200 Status Code says that “all is well” and tells your visitor that they correctly viewed the right page.

The 404 means:

The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address. This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable.

Almost all web servers are set to use the 404 and not the 410, even though the webmaster generally means that the pages are “gone forever”. Now, if we really want to get search engine crawlers confused, we do this:

We make a custom 404 page, and the reply to the Request-URI with a 200 Status Code, telling the world everything is okay! This is a sure-fire recipe for more bloat, and duplicate pages pumped into the supplemental index. When the crawler crawls the page we think is gone, it finds the custom 404 page and thinks everything is okay.

We’re better off telling the crawlers what we really mean, by displaying custom headers.

Here’s a simple way to add 404 headers using PHP

You can add this code to the top of your custom 404 file, so that it displays the correct status code. Make sure it appears before anything else is outputted, to avoid error messages. To recap:

1) If you use a custom 404, make sure the status is 404 by checking with a Server Header Checker which shows the status codes.
2) If the status code is 200, then make sure to change it to a 404 using PHP (or ASP) or whatever programming language you use. This should tell the search engines what you mean.

.

  1. 1 Trackback(s)

  2. Dec 11, 2006: Caveats And Tips Concerning Search Engine Friendly URLs

Sorry, comments for this entry are closed at this time.