Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 know that this question comes up often, I followed many examples and suggestions, but i just cant get it to work. Heres what I need to achieve:

I have two configure two domains to redirect to subdomain of one of them: (and and should all send 301 Moved Permamently header and redirect to

I've set up NamedVirtualHost for as follows:

Redirect 301 ^/

And that seems to work for but does not redirect, whole setup seems to be ignored and files from server's default host configuration setup are served.

As for redirecting from to I created two NamedVirtualHosts, is the actual site with its configuration (ServerName set to and is configured with this:

Redirect 301 ^/

And this configuration also fails.

From what I read about redirecting within Apache Redirect directive should be sufficient to achieve what I need. I could use some mod_rewriting or even use PHP and appropriated headers() to do what I want, but can someone please explain to me what is wrong with my thinking and this configuration.


share|improve this question


Redirect permanent /(.*)$1

Incase you don't want to append the request to the domain then you can do

Redirect permanent /(.*)
share|improve this answer

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.