title: IIS Rewrite rule for a subfolder path
body: <p>i am hosting a couple of websites on different servers and i am using IIS 10 + url rewrite on the frontend server as a reverse proxy only.</p>
  
  <p>the redirection is as follows :</p>
  
  <ul>
  <li>www.example.com   rewrite to server A :</li>
  <li>siteB.example.com rewrite to server B :</li>
  <li>siteC.example.com rewrite to server C :</li>
  </ul>
  
  <p>This scheme allows me to only have one certificate to manage for all my subdomain websites</p>
  
  <p>This is working fine on subdomains  with conditions matching rules.</p>
  
  <p>Now i want to do a rewrite rule from a sub directory to map the entire site D to that subdirectory.</p>
  
  <p>example: </p>
  
  <ul>
  <li>www.example.com/siteD   rewrite to server D :</li>
  </ul>
  
  <p>the site redirects the first page but the aspect look weird and links are not functioning.</p>
  
  <p>is it the right way to handle that with conditions {C:2} or should the pattern be applied to the match url ?</p>
  
  <p>here is my web.config :</p>
  
  <pre><code>&lt;rule name="www.example.com_site_d" stopProcessing="true"&gt;
                      &lt;match url="(.*)" /&gt;
                      &lt;conditions logicalGrouping="MatchAll" trackAllCaptures="true"&gt;
                          &lt;add input="{HTTP_HOST}" pattern="^www.example.com$" /&gt;
                          &lt;add input="{REQUEST_URI}" pattern="^(/siteD/)(.*)$" /&gt;
                      &lt;/conditions&gt;
  &lt;action type="Rewrite" url="http://myinternalsited:80/{C:2}" logRewrittenUrl="true" /&gt;
  </code></pre>
  
  <p>Thanks</p>