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

Will this redirect work [a-z]* to

ie., I want to redirect anything to

Thanks Jean

share|improve this question

Putting RedirectPermanent / in your Apache httpd configuration should do the trick.

share|improve this answer

If you want to redirect anything to, what you probably want is something like this:

RewriteRule ^[a-z]*$ [R,L]

This will redirect ANY request made to the any part of your URL to I.e., => => => (not forwarded)
share|improve this answer
and if I want to redirect to, do I write something like this---------------------------><VirtualHost *:80> ServerName ServerAlias * Redirect permanent / </VirtualHost> – Jean Nov 1 '10 at 7:23
I may have misunderstood your question. I thought you were only trying to forward requests that matched a pattern. If you just want to have the entire domain forwarded, joschi's answer is the better one. – Andrew M. Nov 1 '10 at 7:26
my question stands as it is. But I got confused with the adding of virtual host in the httpd.conf and the rewriterule. I want to add it to the httpd.conf than to the www directory – Jean Nov 1 '10 at 7:37
In the case of RewriteRule, you can add it inside or outside a VirtualHost directive. Adding it to the VirtualHost will only rewrite for requests matching that host. – Andrew M. Nov 1 '10 at 7:46

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.