开发者

ModRewrite redirect dynamic sub-domains

I'm trying to achieve the following :

when user is trying to ac开发者_运维知识库cess "user1.domain.com"

I'd like to redirect to : "user1.anotherdomain.com"

I've tried this rule, but that didn't work

RewriteRule ^(.*).domain.com$ $1.anotherdomain.com [R=301,NC]

Any help is much appreciated!


Sounds like this ought to work:

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜