Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
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 '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

 
discard

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