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

How do I redirect requests coming to to

Reading the apache docs on when not to use the rewrite mod, I tried a simple redirect e.g.


But when I visit, it doesn't redirect me. Any suggestions?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Can you do a different <VirtualHost> for

If you can, just put your Redirect config there:

<VirtualHost *:80>
    Redirect /

If for some reason you still need to piggy-back on the other vhost, or need to handle all subdomains and not just "blog", then use mod_rewrite:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^([^\.]+)\.mysite\.com$
RewriteRule ^/(.*)$$1 [R=301,L]
share|improve this answer
This worked, but I had to comment out ServerAlias * in my VirtualHost. That wasn't so bad. The only things it was catching were blog. and www., so I just changed the * to www and was all set! Much thanks! – Ben McCormack Aug 21 '12 at 1:01

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.