Forum Moderators: phranque

Message Too Old, No Replies

Soft 404 Error

How to make a hard 404 error on Apache...

         

gatonegro

8:32 pm on Nov 22, 2006 (gmt 0)

10+ Year Member



We're using a custom 404 error page in our .htaccess file to redirect users if they visit a dead page.

The problem is that Google's Webmaster Tools verification says we're using a "soft 404" and that the header response is a "200" instead of a "404".

Example:
ErrorDocument 404 http://www.example.com/

We're using industry standards for the 404 error directive in the .htaccess file, so what are we doing wrong and where do we need to look for a solution?

How do we get the header response to show a 404 error code instead of the 200 it presently is?

Thanks in advance!

Cory

[edited by: encyclo at 8:55 pm (utc) on Nov. 22, 2006]
[edit reason] switched to example.com [/edit]

encyclo

8:59 pm on Nov 22, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You need to use a relative URL not the full domain name in the
ErrorDocument
directive to trigger the correct 404 Not Found response. Your use of the full domain name triggers a redirect and thus a 200 OK response. For example:

ErrorDocument 404 /404.html

It is usually considered bad practice to redirect 404 errors to the home page - a custom 404 error page with links to relevant content is a far better solution.