views:

30

answers:

1

Hello , guys I need some help on mod rewrite 301 , to redirect my old website address to the new address , here is my scenario

ive www.domain1.com/page1/ want to be redirect to domain2.com/page1/

ive to replace all request goes to domain1 with domain2 and keep the page after .com so watever was after .com should be the same just replace domain1 with domain2 . anyone can help me with this Regards

A: 

You may want to make sure UseCanonicalName is off, lest apache replace hostnames with the site's ServerName.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.domain1\.com$    [NC]
RewriteRule ^(.*)$       http://domain2.com$1   [R=301]
cHao