Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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] => [subdomain]

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.


share|improve this question
up vote 4 down vote accepted

I think you can use something like this:

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

Your Answer


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.