title: IIS UrlRewrite RewriteMap with HTTP Host condition
body: <p>How can I use two different RewriteMaps based on the HTTP-Host to achieve something like the following?</p>
  
  <p><strong>www.myfoo.com/test</strong> should be rewritten to <strong>/foo/test.aspx</strong><br>
  and<br>
  <strong>www.mybar.com/test</strong> should be rewritten to <strong>/bar/test.aspx</strong></p>
  
  <p>So far I've found <a href="http://forums.iis.net/t/1177509.aspx/1" rel="nofollow">http://forums.iis.net/t/1177509.aspx/1</a> and adapted it to my needs:</p>
  
  <pre><code>&lt;rule name="Rewrite rule1 for rewritemapFoo"&gt;
   &lt;match url=".*"/&gt;
   &lt;conditions&gt;
     &lt;add input="{HTTP_HOST}" pattern="^www\.myfoo\.com$" /&gt;
     &lt;add input="{URL}" matchType="Pattern" pattern="^.+\.((axd)|(js)|(xaml))$" ignoreCase="true" negate="true"/&gt;
     &lt;add input="{rewritemapFoo:{REQUEST_URI}}" pattern="(.+)"/&gt;
   &lt;/conditions&gt;
    &lt;action type="Rewrite" url="{C:1}" appendQueryString="false"/&gt;
  &lt;/rule&gt;
  
  &lt;rule name="Rewrite rule1 for rewritemapBar"&gt;
   &lt;match url=".*"/&gt;
   &lt;conditions&gt;
     &lt;add input="{HTTP_HOST}" pattern="^www\.mybar\.com$" /&gt;
     &lt;add input="{URL}" matchType="Pattern" pattern="^.+\.((axd)|(js)|(xaml))$" ignoreCase="true" negate="true"/&gt;
     &lt;add input="{rewritemapBar:{REQUEST_URI}}" pattern="(.+)"/&gt;
   &lt;/conditions&gt;
    &lt;action type="Rewrite" url="{C:1}" appendQueryString="false"/&gt;
  &lt;/rule&gt;
  
  
  ...
  
   &lt;rewriteMap name="rewritemapFoo"&gt;
     &lt;add key="/test" value="/foo/test.aspx"/&gt;
   &lt;/rewriteMap&gt;
   &lt;rewriteMap name="rewritemapBar"&gt;
     &lt;add key="/test" value="/bar/test.aspx"/&gt;
   &lt;/rewriteMap&gt;
  </code></pre>
  
  <p>Unfortunately, I'll only get a 404 response upon calling www.myfoo.com/test and www.mybar.com/test. Can anyone point out, what I'm missing?</p>