Forum Moderators: phranque
I need to cancel a whole section on a site. The section has been spidered heavily by Google, and I would like to redirect the spiders (and the visitors) to the home page rather than showing the 404 error.
I believe a 301 redirect should do the trick, but I am not able to code it properly:
I tried:
redirect 301 /directory/ http://www.example.com/
but I get a 404
As you can guess I am no Apache server guru.
Thanks
[edited by: jdMorgan at 8:07 pm (utc) on Dec. 26, 2007]
[edit reason] example.com [/edit]
That's not really a very good idea, either from an SEO standpoint or a usability standpoint. You will be creating the appearance of "gateway pages" -- frowned upon by search engines, and you will also confuse your visitors, who are quite likely to try the "bad" URL again, then get frustrated, and go away.
A better solution is to use your custom 404-Not Found page (or better, your 410-Gone page) to explain that the page is missing for unknown reasons (404) or intentionally removed (410) and then provide a text link to your home page. This avoids visitor confusion by acknowledging the problem, and avoids the gateway-page problem as well. You may also wish to add a long-term ( >15 second ) meta-refresh to the custom error page -- long enough for the visitor to completely read and understand the error message, and long enough so that the search engines won't try to treat it as a redirect and re-create the gateway-page problem.
Some earnest advice: Use the HTTP protocol [w3.org] as intended and as specified to avoid long-term problems with search engines. Server response codes are meaningful to both visitors' browsers and to search engine spiders -- Ignore the protocol at your peril.
If you wish to proceed despite this warning, then use RedirectMatch
RedirectMatch 301 ^/directory/(.*)$ http://www.example.com/
Thank you very much for your reply. You are as usual very clear, knowledgeble and to the point. I will use a 410 page gone. I agree with you for the visitors issue, but I was under the impression that search engines would accept the 301 as preferred method to redirect from pages that should be dropped from their index (because the url has changed, the page deleted etc.): the search engine sees the redirect and drops the old URL adding the new one to the index.
I am very interested in discussing this point because I have used extensively 301 redirects in one site that I have restructured several times, and I have to say that it does perform way worst (in terms of SERPs) than others where I have not used so many 301s.
Please address me to other threads if you believe this forum is not apprpriate for this discussion.
Thanks
Try searching for "doorway pages" for more information. Beware that using doorways used to be a widespread black/grey-hat SEO practice, search engines figured it out many years ago, and that is why it is now somewhat dangerous to your ranking.
Since this is now primarily an SEO-related question, it would be more appropriate to discuss it in one or more of the search engine forums. You will also benefit there from many more opinions and a wider experience base. :)
Jim