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

In my httpd.ini I redirect all traffic from "" to "", the below works fine for this:

RewriteCond %HTTPS off 
RewriteCond Host: (?!^ 
RewriteRule /(.*) http\://$2 [I,RP]

I have a bunch of microsites which also use this website, say "", set in the Host Headers of IIS 6. With the above rules, "" ends up at ""!

Is there a RewriteCond I can do against the request to make sure that the request is for "" to not capture the microsites and rewrite those? Or even better, a way I can take any request, be it "" or "" and just wack a www in front of it?

Thanks for your help.

share|improve this question

I made this work with multiple URLs (and Andrews help), with the below.

RewriteCond %HTTPS off 
RewriteCond Host: (?!^www.+)(.+) 
RewriteRule /(.*) http\://www.$1/$2 [I,RP]
share|improve this answer

Try using the following:

RewriteCond %HTTPS off 
RewriteCond Host: !^www\..+ 
RewriteCond Host: ^(example|foobar)\.co\.uk
RewriteRule /(.*) http\://www.$$2 [I,RP]
share|improve this answer
Unfortunately, this doesn't work "" and "" stay as such, no www. on the front. It no longer breaks anymore though, but then it doesn't do anything else either :(. – MagicalArmchair Jun 14 '12 at 14:24

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.