Forum Moderators: phranque
currently i am transfering all 404 page not founds to the index page of my site through a line in my .htaccess which goes like this
ErrorDocument 404 [my-site.com...]
1> is this practice of transfering 404s to the index page right? is it by any chance considered to be some kind of spam by search engines.
2> lately i found out that this custom 404 setup is giving out "HTTP 200 OK" response instead of "HTTP 404 Not Found", i found this out when i tried to verify my site while submitting google site map and also by reading this post [webmasterworld.com...] and [help.yahoo.com...]
so what do u guys think should be done?
if its okay to tranfer 404s to the homepage then how do i make it give out the correct "http 404 not found" response.
if its not the right practice to transfer 404s to the homepage then what is the best practice to get the 404 referals into the site (with giving out the right 404 response)
thank you
Your directive should read:
ErrorDocument 404 /
This response code behaviour is clearly described in the documentation for the ErrorDocument [httpd.apache.org] directive.
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. Provide a 404 error page that says, "The page you requested is missing or has been removed from our Web site. If you are seeing this message after clicking on a link on our site, please report this error <link to webmaster contact form or mailto:webamster@yourdomain link here>. Otherwise, please click one of the links below to continue." Then provide links to your home page, site map, or any other resources you may have to help the user find what they were looking for.
Note that in the case of intentionally-removed pages, you should provide a 410-Gone response using mod_rewrite if possible. Then you could have a page almost identical to the 404 page, except that the text would read, "The page you requested has been removed from our Web site. If you are seeing this message after clicking on a link on our site, please report this error <link to webmaster contact form or mailto:webamster@yourdomain link>. Please click one of the links below to continue."
For both the 404 and 410 error pages, you can optionally include a seven- to fifteen-second meta-refresh to send the browser to either the home page or site map at your discretion. Make the time long enough so that the user can carefully read the text on the page and make an informed decision, though.
If you use a contact form for reporting bad links, then it can capture the HTTP_REFERER to get the bad URL and post it as a hidden variable.
For intentionally-replaced pages, where the URL has been changed or the page replaced by a more or less specific page, you should implement a 301 redirect to the replacement page, so that visitors and search engine robots get a 301, not a 404.
Jim
this does not work, it still returrns 200 ok in the header!
also I have a problem if i do not specify any errordocument at all. Is there a setting somewhere to NOT return 200 in the header EVER?
that would be nice!
Welcome to WebmasterWorld!
> I have the same problem and have used the errordocument correctly, with just a / and no file
[quote]When used with a local-URL path, the correct server status code will be returned. When used with a canonical URL, a redirect is performed, with the browser first receiving a 302-FOund redirect. The browser then fetches the URL given in the 302 response, and sees a 200-OK status.[/url]
The issue is not the "and no file." It is the use of "http://www.example.com" in front of the local URL-path.
If you specify such a canonical URL, you will invoke a 302-Found redirect. So the proper form for an error document located on the same server is not
ErrorDocument 404 http://www.example.com/page.html
ErrorDocument 404 /page.html
When encountering problems with server responses, it is often useful to 'walk through' the entire request-response sequence using a Server Headers checker [webmasterworld.com].
Jim
ErrorDocument 404 /
</VirtualHost>
OK that is what I have and i still get this error, even if i remove the errordocument completely!?
I have a feeling its because my domain hoster uses a frame forwarding to get to my IP (so that my IP does not replace the address in the address bar)
Is there a way around this (eg. DNS entries ;) )
Again, the Server Headers checker will show you when/where the redirect is being invoked. Just enter your domain name and (optionally) a particular page, and look at your server's (or domain hoster's) response. If that's a redirect, then enter the URL given in the redirect response, and see what response you get to that request. You can follow the browser requests and server responses, step-by-step, until your initial request is resolved to an actual page on your site.
Jim
Assessing the problems you've probably had in getting pages well-ranked while returning improper server responses, and accounting for the cost-of-time you'll spend fixing this problem, I suspect you will find that the static IP charge is well worth it. You might also look into much-better-than-cheap-grade hosting for the same reasons. Any site that does or can produce a profit of $35 a month justifies enterprise-grade commercial hosting, and I recommend that approach to all.
To put it another way, cheap hosting can be very costly in terms of search engine ranking, site capability (and therefore appeal to users), maintainability, security, reliability, and portability. When these 'intangible' costs are accounted for, cheap hosting is very expensive.
Jim