I have 3 domains:
domain1.com domain2.com domain3.com
I want to 301 redirect all to domain3.com/$1. That includes domains with www and non-www.
domain1.com -> domain3.com www.domain1.com/$1 -> domain3.com/$1
domain2.com -> domain3.com www.domain2.com/$1 -> domain3.co开发者_如何学Cm/$1
domain3.com X-> domain3.com (no redirect) www.domain3.com/$1 -> domain3.com/$1
Many thanks
The following will 301 redirect domain1.com and domain2.com to domain3.com. Add the www if you want it for domain3.com
RewriteCond %{HTTP_HOST} ^(www\.)?domain1\.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?domain2\.com$ [NC]
RewriteRule (.*) http://domain3.com/$1 [R=301,L]
精彩评论