Forum Moderators: phranque

Message Too Old, No Replies

permanent 301 redirect for folder/subfolders

         

basquen

10:37 am on Oct 1, 2007 (gmt 0)

10+ Year Member



I'm in the process of redirecting our old site to a new version. I've used an .htaccess to individually redirect individual pages to their corresponding replacements - this works fine.
I also have a folder + subfolders where their entire content needs to be redirected to an individual page of the new site. Rather then redirect each individual page I want to redirect the folder aand everything in it but I can't seem to find the right syntax to achieve this.

So far I've tried :
redirect 301 /mainfolder/ http://www.newsite.com/targetpage.html
RedirectMatch 301 ^/mainfolder/?$ http://www.newsite.com/targetpage.html

Can anyone point me in the right direction?

Thanks

[edited by: jdMorgan at 2:10 pm (utc) on Oct. 2, 2007]
[edit reason] de-linked [/edit]

jdMorgan

8:50 pm on Oct 1, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The following should all function identically, "copying" the original page name to the new URL:

Redirect 301 /mainfolder/ http://www.newsite.com/
-or-
RedirectPermanent /mainfolder/ http://www.newsite.com/
-or-
RedirectMatch 301 ^/mainfolder/(.*)$ http://www.newsite.com/$1

See Apache mod_alias [httpd.apache.org]

Jim

[edited by: jdMorgan at 9:10 pm (utc) on Oct. 1, 2007]

basquen

11:31 pm on Oct 1, 2007 (gmt 0)

10+ Year Member



Thanks Jim,

Infact what I was trying to achieve was to drop the original file names and redirect a whole folder (and subfolders) to a single page on the new site. I'll have a look at the link

g1smd

9:40 am on Oct 2, 2007 (gmt 0)

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



I am not so sure about the validity of redirecting a whole folder, and especially of redirecting a whole site, to one single URL on another site (as far as how search engines treat what you are doing as being valid or trying to game the system).

It is a very good way to keep your traffic from your old external links and bookmarks. However, I would think that it would be at least partially discounted from passing any PR.

Redirecting individual pages, even if site-wide, is linking relevant topics together. However, funnelling multiple old pages to one new URL is likely not doing that, at least often not to any useful extent.

The guys who go around buying old domains with lots of high PR pages and then redirecting the entire site to some other site, in order to try to suck the PR benefits out, have already spoilt that for the rest of us.

jdMorgan

2:10 pm on Oct 2, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you really want to drop the URL-paths (see warning above), then you can use this RedirectMatch directive, slightly-modified from that posted above:

RedirectMatch 301 ^/mainfolder/(.*)$ http://www.example.co[b]m/[/b]

Jim