Forum Moderators: phranque

Message Too Old, No Replies

Redirect domain 1 to domain 2

How to write the 301 re-direct

         

onedodd

1:26 am on Feb 15, 2006 (gmt 0)

10+ Year Member




I have a site I am doing a little work on and am not sure how to write a 301 redirect.

Let me explain the situation.

*ww.site-1.com and *ww.site-2.com go to the exact same home page. 2 seperate domain names using the same home page.

I want to re-direct *ww.site-1.com to *ww.site-2.com so there isn't an issue with duplicate content.

Can somebody show me how to write this 301 redirect? Don't know how else to ask but I am somewhat lost on this one.

I am grateful for any help I can get.

Little_G

3:33 pm on Feb 15, 2006 (gmt 0)

10+ Year Member



Hi,

This should work if you add it to site-1's config:


RewriteEngine on
RewriteRule ^(.*) http://www.site-2.com [R=301,L]

Andrew

[edited by: jdMorgan at 6:16 pm (utc) on Feb. 15, 2006]
[edit reason] De-linked [/edit]

jdMorgan

4:27 pm on Feb 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are both domains hosted in the same 'account' on the same server?

If so, you'll need to use a conditional redirect to avoid a, 'infinite' redirection loop:


RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?site-1\.com
RewriteRule (.*) http://www.site-2.com/$1 [R=301,L]

Jim
[edit] De-linked [/edit]