2

Our web app lies at bar.com/myapp

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

So need to transparently rewrite foo.bar.com to bar.com/myapp using the URL Rewrite module in IIS

But still need to be able to go to www.bar.com and see the company website and webmail.bar.com, 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 bar.com

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

1 Answer 1

1

REMOVED NON RELEVANT INFO AND EDITED

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.

4
  • 1
    The subdomain needs to be rewritten, not forwarded. They should be able to browse the website at foo.bar.com/login.html where this is actually bar.com/myapp/login.html 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, 2010 at 16:47
  • OK that makes sense then. I edited my post
    – Campo
    May 19, 2010 at 17:42
  • Thanks, I got it working. Will edit first post with info to help others
    – Igor K
    May 19, 2010 at 19:03
  • Good Job! Glad it's working.
    – Campo
    May 19, 2010 at 19:25

You must log in to answer this question.