Reputation: 749
I'm trying to achieve the following :
when user is trying to access "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!
Upvotes: 1
Views: 61
Reputation: 38309
Sounds like this ought to work:
RewriteCond %{HTTP_HOST} ^(.*)\.domain\.com$ [NC]
RewriteRule ^/(.*)$ http://%1.anotherdomain.com/$1 [R=301]
Upvotes: 1