title: Capture part of URL to use in Outbound rule for rewrite module in IIS
body: <p>Is there a way to capture part of the url in an outbound rule to use as value for the re-write?</p>
  
  <p>Right now, I'm using a precondition, where I have an input with a pattern against the {REQUEST_URI}. I'd like to use a capture group from the request URI in the outbound rule that uses this precondition. I tried {C:1} but that didn't work.</p>
  
  <p>Precondition:</p>
  
  <pre><code>&lt;preCondition name="Html Response" logicalGrouping="MatchAll"&gt;
      &lt;add input="{REQUEST_URI}" pattern="myapp(.*)" /&gt;
      &lt;add input="{RESPONSE_CONTENT_TYPE}" pattern="^(text/html)" /&gt;
  &lt;/preCondition&gt;
  </code></pre>
  
  <p>Outbound rule:</p>
  
  <pre><code>&lt;rule name="ResponseRewriteRelative" preCondition="Html Response" stopProcessing="true"&gt;
      &lt;match filterByTags="A, Link" pattern="^/(.*)" /&gt;
      &lt;action type="Rewrite" value="{C:1}/{R:1}" /&gt;
  &lt;/rule&gt;
  </code></pre>
  
  <p>where {C:1} would be the capture group from precondition "myapp(.*)"</p>
  
  <p>So, it'd go from 
  <a href="http://myapp40.com" rel="nofollow">http://myapp40.com</a>
  to rewrite links in the response to something similar to
  40/originalrelativelink</p>
  
  <p>Thanks!</p>