Forum Moderators: phranque
Redirect permanent /oldfolder/index.htm [mysite.com...]
Redirect permanent /oldfolder/file.htm [mysite.com...]
Redirect permanent /oldfolder/oldfile.htm [mysite.com...]
My problem is that [mysite.com...] is still ranking very highly on Google but gives a 404 missing file error when Google's link is clicked. The cached page shows my old [mysite.com...] but the "index.htm" part of the URL is invisible in Google's stored URL (presumably because it's called index.htm, depsite it not being in the root folder).
How should I solve this, without just waiting for Google's index to sort itself out? I am considering adding one of the following lines?:
Redirect permanent /oldfolder/ [mysite.com...]
But wouldn't this try to link all the files below the oldfolder to corresponding files in newfolder? (i.e. something I really don't want).
Or might the following line work?:
Redirect permanent /oldfolder/ [mysite.com...]
thanks
However, for best results from both s usability and search engine ranking viewpoint, you should 301 redirect each old page to one of the following, in order of effectiveness:
Jim
As you recommend, I've already got a permanent (301) redirect for every changed file in the old structure to its corresponding file in the new structure. But I still get the Google 404 error for the folder because the Google result is pointing to a folder, not a file. And I can't redirect that folder because it's contents are not named like-for-like in the new folder.
So I guess what I'm looking for in this case is a line which permanently redirects the folder itself, WITHOUT redirecting any of the files in it (because they are redirected one by one on separate lines).
I checked out your link to Apache's RewriteMatch documentation and I'm afraid I couldn't work out how to achieve what I'm trying to do. Sorry to be dim.
thanks
To demonstrate, let's take an example:
Redirect 301 /folder/ http://www.example.com/newfolder/
RedirectMatch 301 ^/folder/ http://www.example.com/newfolder/
RedirectMatch 301 ^/folder/$ http://www.example.com/newfolder/
RedirectMatch 301 ^/folder/(.+)$ http://www.example.com/newfolder/xyz/$1
This example only illustrates some of the possibilites, since all of the RedirectMatch patterns are start-anchored, but it should be enough to get you going.
Jim
RedirectMatch 301 ^/oldfolder/$ [mysite.com...]