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

I want simple to rewrite everthing from OLD.COM to NEW.COM including subdomains and stuff - whatever user types in should just be replaced with NEW.COM and the rest of it stays as is. I tried this but it's not working for subdomains.

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^((www\.)?[^\.]+)\.old\.com [NC]
RewriteRule ^(.*)$$1 [R=301,L]

What did I miss? Thanks Bob

share|improve this question

Delete all the subdomains in the apache config and replace it with this:

Listen *:80
<VirtualHost *:80>
    DocumentRoot /var/www/ #Wherever your site is located now
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^(.*)olddomain\.com$ [NC]
    RewriteRule ^(.*)$$1 [R=301,L]

That should redirect all subdomains.

share|improve this answer
I tried it and this error comes up: "The server encountered an internal error or misconfiguration and was unable to complete your request." – Bob Apr 3 '11 at 18:51
Sorry, had a \ that wasn't supposed to be there. Does it work now? – Bart De Vos Apr 3 '11 at 18:53
still nothing happens if "WWW" is missing or by entering subdomains ( + ) – Bob Apr 3 '11 at 19:24
Made some changes. Please try again. – Bart De Vos Apr 3 '11 at 20:17
only thing left is that subdomains aren't working are (like "") - is it a server-based problem or can it be solved via .htaccess? – Bob Apr 3 '11 at 20:58

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.