2011-03-29 95 views
1

我试图实现以下目标:ModRewrite重定向动态子域

当用户试图访问“user1.domain.com”

我想重定向到:“USER1。 anotherdomain.com”

我已经试过这条规则,但没有奏效

重写规则^(。*)。domain.com $ $ 1.anotherdomain.com [R = 301,NC]

任何帮助都很赞赏ated!

回答

1

听起来这应该工作:

RewriteCond %{HTTP_HOST} ^(.*)\.domain\.com$ [NC] 
RewriteRule ^/(.*)$ http://%1.anotherdomain.com/$1 [R=301] 
+0

真棒!非常感谢Martin! – Nerses 2011-03-29 21:16:56