title: How to set up URL Rewrite on IIS7 so that multiple subdomains redirect to the correct web site?
body: <p>I asked a <a href="https://stackoverflow.com/questions/4655577/how-to-create-subdomains-for-iis7-programmatically">previous question</a> about how to have multiple subdomains all pointing at the same site; the answer I accepted there was to use URL Rewrite.</p>
  
  <p>Cool.  But for the life of me I cannot figure out how URL Rewrite works, and I consider myself a relatively smart guy.  |-)  Lots of questions...</p>
  
  <ul>
  <li>Each customer (and there will be hundreds, if not thousands) gets their own subdomain e.g. <code>customer1.mydomain.com</code>, <code>cooldude.mydomain.com</code> etc.  The regex would be <code>(.+)\.mydomain\.com</code>, and all of these URLs should be redirected to a website on IIS that I've named <code>customers.mydomain.com</code>.  All the examples I've found on URL Rewrite are about referencing documents, e.g. <code>mydomain.com/thing.aspx?id=123</code> changes to <code>mydomain.com/thing/123</code>, which I'm not really interested in.  Here's a clue: as you can see in the picture below, the "Input" column always says "URL path after '/'" - but there doesn't appear to be any way to change that.</li>
  </ul>
  
  <p><img src="https://i.stack.imgur.com/crf3K.jpg" alt="URL Rewrite pic"></p>
  
  <ul>
  <li>I am assuming that the rewrite rule should be put on the default web site, but I want the rule to redirect to the <code>customers.mydomain.com</code> web site.  How do you force the redirect to a specific web site, in such a way that I will still be able to see the subdomain name (which determines the customer site I'm logging into)?</li>
  </ul>