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

Our web app lies at

We'll use the HTTP Host Header to work out the username

So need to transparently rewrite to using the URL Rewrite module in IIS

But still need to be able to go to and see the company website and, etc.

Got it working:

Add a server wide Inbound Rule: Match URL: (.*) - check every URL

Condition {HTTP_HOST} ^([^.]+)\.bar\.com - must be a subdomain of

Condition {HTTP_HOST} Doesn't Match Pattern: webmail\.|mail\. - don't run for webmail. or mail.

Action Rewrite: myapp/{R:1} - redirect to /myapp/ keeping all querystring data

share|improve this question
up vote 1 down vote accepted


SO if you are using IIS7 download the URL Rewrite Module. All the instructions and info you need are included at that link.

Hope that helps.

share|improve this answer
The subdomain needs to be rewritten, not forwarded. They should be able to browse the website at where this is actually I think that has to be done with some sort or URL rewriting so that all relative images, etc still work and the real URL is masked from the end user – Igor K May 19 '10 at 16:47
OK that makes sense then. I edited my post – Campo May 19 '10 at 17:42
Thanks, I got it working. Will edit first post with info to help others – Igor K May 19 '10 at 19:03
Good Job! Glad it's working. – Campo May 19 '10 at 19:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.