Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Hey all, I'm trying to move to another domain, but have many subdomains under the existing domain. All the subdomains will be the same but just mapped with the new domain.

[subdomain].xyz.com => [subdomain].abc.com

The DNS is set up so all requests are going to the proper box, and I have a vhost set up to respond to them all, I just need to now redirect the domains.

Ideas?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

I think you can use something like this:

<VirtualHost *:80>
    ServerName xyz.com
    ServerAlias *.xyz.com
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^(.*)xyz.com$
    RewriteRule ^.*$ http://%1abc.com$0
</VirtualHost>
share|improve this answer
    
Perfect man, thanks! RewriteCond %{HTTP_HOST} ^(.*)?xyz\.com$ [nocase] RewriteRule (.*) http://%1abc.com/$1 [R=301,L] You saved my tail ;) –  bigdawggi Jul 16 '10 at 10:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.