Iis – Using IIS URL Rewrite, how to rewrite foo.bar.com -> bar.com/theapp

iisrewrite

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

Best Answer

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.

Related Topic