title: .Net web.config match base URL
body: <p>We have a CMS where we host multiple sites under the various subdomains but with the same main domain:</p>
  
  <p>Example:</p>
  
  <p>sub1.mysite.com</p>
  
  <p>sub2.mysite.com</p>
  
  <p>This being the same application they share the same web.config. So when I try to write a rewrite rule and a similar match exists in another subdomain site, the rewrites take affect for all sites.</p>
  
  <p>What I want is to match on the base level domain (mysite.com or sub.mysite.com) and make my rewrite rules?</p>
  
  <p>All the answers I find say to use something like </p>
  
  <pre><code> &lt;match url="^(.*)$" ignoreCase="true" /&gt;
   or &lt;match url="^mypage/?(.*)$" /&gt;
   or &lt;match url="^mypage/mysubpage//?(.*)$" /&gt;
  </code></pre>
  
  <p>But the problem with looking at any of these is that the carat '^' is kind of a wild card and not domain/subdomain specific.  </p>
  
  <p>Lets say I want to have a rewrite rule for </p>
  
  <p>mysite.com/about-us</p>
  
  <p>and a sub domain site has a page named the same</p>
  
  <p>sub1.mysite.com/about-us</p>
  
  <p>BUT I ONLY want to a rewrite for the main mysite.com/about-us and NOT have the sub1.mysite.com/about-us site have the same rewrite rule.</p>
  
  <p>How would I tell it that I only want mysite.com/about-us to rewrite to mysite.com/about/about-us?</p>