title: URL Rewrite to subdomain
body: <p>For a URL rewrite I need support.mydomain.com to point to mydomain.com/support. What I have is rewriting to support.mydomain.com/support.</p>
  
  <p>I've tried 2 different variations, but no luck. Any help is greatly appreciated.</p>
  
  <p>Version 1</p>
  
  <pre><code>&lt;rewrite&gt;
      &lt;rules&gt;
          &lt;rule name="rewrite support" enabled="true"&gt;
              &lt;match url="(.*)" /&gt;
              &lt;conditions logicalGrouping="MatchAny"&gt;
          &lt;add input="{HTTP_HOST}" pattern="^support.mydomain.com$" /&gt;
          &lt;/conditions&gt;
          &lt;action type="Rewrite" url="\support\{R:0}" /&gt;
          &lt;/rule&gt;
      &lt;/rules&gt;
  &lt;/rewrite&gt;
  </code></pre>
  
  <p>Version 2   </p>
  
  <pre><code>&lt;rule name="Support Rule" stopProcessing="false"&gt;
      &lt;match url="(.*)" /&gt;
       &lt;conditions&gt;
           &lt;add input="{HTTP_HOST}" pattern="^(?!www)(\w+)\.mydomain\.com$" /&gt;
       &lt;/conditions&gt;
       &lt;action type="Rewrite" url="{C:1}/{R:1}" /&gt;
  &lt;/rule&gt;
  </code></pre>