Page 1 of 1

Redirecting S9Y to a new domain

Posted: Wed Feb 04, 2009 3:15 am
by tpost
Hi everyone,

We're planning on switching our domain to a new one, and would like to redirect all our S9Y posts to the new domain.

Say I have this permalink structure:

http://www.a.com/blog/archives/permalink.html

I want to be able to redirect this to:
http://www.b.com/blog/archives/permalink.html

Is there an easy ReWriteRule for the .htaccess file to do this?

Thanks for reading!

Re: Redirecting S9Y to a new domain

Posted: Wed Feb 04, 2009 10:14 am
by kleinerChemiker

Code: Select all

RewriteRule ^http://www.a.com/(.*) http://www.b.com/$1 [R,L]
this could maybe work

Re: Redirecting S9Y to a new domain

Posted: Thu Feb 05, 2009 12:54 am
by tpost
Thanks for replying kleinerChemiker!

I have a follow-up question:

What if I were to put the .htaccess file under the "blog" folder instead of the root directory, what would the Rewriterule be then?

Re: Redirecting S9Y to a new domain

Posted: Thu Feb 05, 2009 11:22 am
by kleinerChemiker
if the old one and the new one uses "blog" as subfolder, you could use the same code. If not, only add the subloder like:

Code: Select all

RewriteRule ^http://www.a.com/blog/(.*) http://www.b.com/$1 [R,L]

Re: 301 redirects

Posted: Thu Feb 12, 2009 7:56 am
by mdnava
Careful with redirects, too many 302 redirects can get you penalized on search engines, especially Google.

If the move is permanent then you should use permanent 301 redirects:

Code: Select all

RewriteRule ^(.*)$ http://www.b.com/$1 [R=301,L,QSA]