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?
Answer
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>
Attribution
Source : Link , Question Author : bigdawggi , Answer Author : David Z