Previous: Adding Fedora and Windows to my Ubuntu Installation
Next: Some Handy Linux Commands

ErrorDocument in .htaccess Returns 302 Response

October 15th, 2007

Just thought I would help out anybody who has this same problem. When using a custom error page to hand 404 errors, you need to make sure you use the local path to the script and not a full URL, otherwise the server needs to use a redirect to get to the page. This will cause a message from Google Webmaster Tools such as "We've detected that your server returns a status of 200 (found successfully) for pages that don't exist. "


So, this line in your .htaccess is the WRONG way:
ErrorDocument 404 http://www.micahcarrick.com/404.php
And this would be correct:
ErrorDocument 404 /404.php

This is easy to test for if you have curl installed on your system using:
curl --header http://www.micahcarrick.com/this-doesnt-exist.html
The right way returns 404, the wrong way returns 302.



Categories
Web Development

Related Posts
  • No Related Posts


Technorati Tags

One Response to “ErrorDocument in .htaccess Returns 302 Response”

RSS Subscription Comments RSS Feed

  1. Piutx! Says:

    Thanks!

Leave a Reply