ErrorDocument in .htaccess Returns 302 Response

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.
Did you enjoy ErrorDocument in .htaccess Returns 302 Response? If you would like to help support my work, A donation of a buck or two would be very much appreciated.
blog comments powered by Disqus
Linux Servers on the Cloud IN MINUTES