title: Setting up URL Rewrite rule for a specific domain
body: <p>For local dev testing, I need to catch all requests to <code>www.somedomain.com/XXX</code> (where X is the path), and send them on to <code>localhost/somevdir/XXX</code>.</p>
  
  <p>I've added this to my HOSTS file (c:\windows\system32\drivers\etc):</p>
  
  <pre><code>127.0.0.1   www.mydomain.com
  </code></pre>
  
  <p>Then, in IIS8 (Windows 8), I've added a binding to my "Default Web Site" for the host www.mydomain.com. This works, I can now browse www.mydomain.com/test.html and see a test html page. My virtual dir is inside the Default web site. I then add a URL Rewrite URL to the web site for the last bit:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;rewrite&gt;
      &lt;rules&gt;
          &lt;rule name="mydomain.com" stopProcessing="true"&gt;
              &lt;match url="^www.mydomain.com/(.*)" /&gt;
              &lt;action type="Rewrite" url="localhost/MyVDir/{R:1}" logRewrittenUrl="true" /&gt;
          &lt;/rule&gt;
      &lt;/rules&gt;
  &lt;/rewrite&gt;
  </code></pre>
  
  <p>But - that doesn't work. I get a 404 so it looks the the match never happens. I've tried redirect and rewrite, and I've tried without the ^ in the regex and a few other regex tweaks. Can someone explain what I've done wrong?</p>