Redirecting S9Y to a new domain

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
tpost
Regular
Posts: 77
Joined: Fri Sep 21, 2007 1:45 am

Redirecting S9Y to a new domain

Post 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!
kleinerChemiker
Regular
Posts: 765
Joined: Tue Oct 17, 2006 2:36 pm
Location: Vienna/Austria
Contact:

Re: Redirecting S9Y to a new domain

Post by kleinerChemiker »

Code: Select all

RewriteRule ^http://www.a.com/(.*) http://www.b.com/$1 [R,L]
this could maybe work
tpost
Regular
Posts: 77
Joined: Fri Sep 21, 2007 1:45 am

Re: Redirecting S9Y to a new domain

Post 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?
kleinerChemiker
Regular
Posts: 765
Joined: Tue Oct 17, 2006 2:36 pm
Location: Vienna/Austria
Contact:

Re: Redirecting S9Y to a new domain

Post 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]
mdnava
Regular
Posts: 57
Joined: Wed Dec 15, 2004 10:17 pm

Re: 301 redirects

Post 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]
Melvin D. Nava
Venelogía
Post Reply