Forest Software

Web, SEO and IT & Business Advice for the Smaller Business

Why does my custom 404 page return a HTTP 200 OK status message?

Q: I am currently trapping all 404 "page not founds" to the index page of my site through a line in my .htaccess file which says

ErrorDocument 404

This works in that all "page not found" errors are redirected to my home page, however I've just noticed that the HTTP status message returned is 200 (OK). Does this mean that the search engines may feel that the pages are duplicates?

A: This problem is caused by one of the most common errors in defining ErrorDocument:

To do what you want your htaccess directive should really read:

ErrorDocument 404 /

This redirects 404 errors to the home page, as defined by your apache site configuration. When the ErrorDocument 404 directive is used with a local-URL path, the correct server status code will be returned. When used with a full URL, a redirect is performed, with the browser first receiving a 302 (page temporarily moved ) redirect. The browser then fetches the URL (and sees an external URL) given in the 302 response, and then finally sees a 200-OK status.

This response code behaviour is clearly described in the documentation for the ErrorDocument directive on the Apache website.

However, I believe that the best practice for error pages is to serve a page which describes the error, and what the user can and/or should do about it. We have, in the past provided a 404 error page that says, "The page you requested is missing or has been removed from our Web site. This error page then provides user with our standard navigation links to help the user find what they were looking for, if the user has not selected anything after 30 seconds we automatically redirect them to the home page via a meta refresh command.

It is more than possible that the search engines may look at your redirected page and consider that it is a duplicate of the home page. Whether this affects your rankings or positions is a question that only the search engines themselves can really answer, there is some evidence though that too many pages being redirected to the home page could trigger a duplication penalty.

If you are having problems creating your .htaccess file you should talk to your webserver hosts, they may be able to help you. It is possible that you do not have access to the .htaccess file, in which case you will have to talk to the people that supply your website hosting, or you may have to change hosting companies.

Alternatively have a look at the forum, there are experts in the forum who are sure to be able to point you in the right direction for any questions on .htaccess.

You should note that this article only applies to Apache webservers, we do not run Microsoft webservers and have no experience of them.


Follow us on Twitter