Forum Moderators: phranque
I've inherited a couple of websites that have been redesigned 4 or 5 times in the last couple of years. There are numerous pages that are either moved/gone now but still listed in search engines or present with no links from the home pages but still getting visitors.
I'm looking for a way to catch 404 errors and return a 301 redirect to the sites' front pages. I think that this would eventually take the pages that are still listed in the search engines out of the search engines with losing the traffic that the links are currently bringing in.
The problem is that there are dozens of these missing/moved pages mixed in with dozens of pages that are still present in their original locations and I can't figure out a way to do a blanket conversion of 404 errors to 301 redirects that won't affect serving the pages that ARE still there.
Does anyone have any ideas or comments on how to do this? Or am I stuck with creating a 301 redirect for each individual missing/moved page?
in your custom errorpage would do the trick.
(same could be done with asp/jsp I think).
If you wish to redirect the old URL to a new equivalent-page URL, and the two URLs have nothing in common, then you will be stuck redirecting each one indvidually.
If there is any commonality, you may be able to take advantage of it to reduce the number of redirect directives. It all depends upon the exact details of the new and old naming system, and if there is, in fact, a system.
Jim
Do you mean something like this?
RewriteEngine on
RewriteCond %{REQUEST_URI} !-f
RewriteRule \.html$ http://www.mysite.com/index.html [NC,R=301,L]
If the file doesn't exist, and its extension is .html (not case sensitive), permanently redirect the request to mysite.com's index.html file.