Forum Moderators: phranque
Any help will be appreciated.
Thx
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.
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...]
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/