开发者

htaccess redirect 301 all to one domain

开发者 https://www.devze.com 2023-01-21 11:17 出处:网络
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.

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]
0

精彩评论

暂无评论...
验证码 换一张
取 消