我想将domain1.com的每个子域重定向到domain2.com
foo.domain1.com -> foo.domain2.com
baz.domain1.com -> baz.domain2.com
bar.domain1.com -> bar.domain2.com
etc
答案 0 :(得分:0)
https://stackoverflow.com/a/8046069/2024688
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.domain1\.com$ [NC]
RewriteRule ^(.*)$ http://%1%2.domain2.com/$1 [L,R]