Forum Moderators: phranque

Message Too Old, No Replies

how to 301 all .htm pages to homepage

how to 301 all .htm pages to homepage

         

digitalpimp

1:14 pm on Dec 1, 2007 (gmt 0)

10+ Year Member



I have many old pages in the serps with broken urls that I would like to 301 redirect to my homepage. All of these pages end in .htm What code would I need to add to .htaccess to 301 redirect them to my homepage. Right now I'm redirecting my 404 page to accomplish this but this is less than ideal.

Any help will be appreciated.

Thx

phranque

2:21 pm on Dec 1, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



welcome to WebmasterWorld [webmasterworld.com], dp!

what you want to do is probably not a good idea.
301 means "the content at this url has been permanently moved to this other url."
you should use the 301 if you have equivalent content at the redirected url.
in this case what you really want to say is that the content is missing or gone.
you should probably send out a HTTP 404 or 410 response code and then a long meta refresh top the home page.
you can either do this (with a 404) in your custom 404 page and treat all "missing" urls the same as the missing *.htm files, or you can use .htaccess to specifically redirect .htm urls to the 404/410 page.

digitalpimp

9:29 pm on Dec 1, 2007 (gmt 0)

10+ Year Member



Yes, I get what youre saying but I really dont want to lose all the links going to these pages

wilderness

10:08 pm on Dec 1, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It's not my intention to appear critical!

This is a difficult lesson for many websmasters.

The ideal situation is implement redirects as part of the process of new page creation.
The key thought being to insure that no traffic loss takes place.

Here's a good read on the subject (i.e., archive org for link longevity):
[web.archive.org...]

g1smd

10:31 pm on Dec 1, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Using a 301 redirect to redirect a large number of multiple URLs all to one new URL, is asking for trouble.

I can't believe that Google would let those redirects pass anything much in the way of PR to the new URL, especially if the topic isn't a very close match.

jdMorgan

11:06 pm on Dec 1, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I agree with the comments posted by others above -- It's simply not a good idea to redirect a large number of pages to your homepage. I'll go even further, actually, and say that it's not a good idea to delete a large number of pages either; Large numbers of page redirects and missing pages on a site are likely treated as a signal of low quality by the search engines.

However, it is our policy to stay on topic and answer the thread owner's question before taking off on other subjects. So to that end, one way to do what you ask is to use RedirectMatch [httpd.apache.org] from Apache mod_alias:


RedirectMatch 301 ^/(.*)\.htm$ http://www.example.com/

Jim

digitalpimp

1:23 am on Dec 2, 2007 (gmt 0)

10+ Year Member



Thank you all very much for your insight into this topic.