title: Building IIS Redirect Rule to Redirect Product Page to New URL Passing Product ID
body: <p>I'm attempting to use the URL Rules engine in IIS 7 to redirect our current product pages to our new product pages.</p>
  
  <p>Old Pages:</p>
  
  <pre><code>example.com/itemform.aspx?item=X12878
  example.com/itemform.aspx?item=Y87304&amp;showmenu=T
  </code></pre>
  
  <p>New URL</p>
  
  <pre><code>example.com/c/product/X12878
  example.com/c/product/Y87304
  </code></pre>
  
  <h3>Attempt</h3>
  
  <pre><code>&lt;rule name="Product Page Redirect"&gt;
    &lt;match url="/itemform\.aspx\?item=([.a-zA-Z0-9]+)$" /&gt;
    &lt;action type="Redirect" url="https://newsite.com/x/product/{C:1}" redirectType="Permanent" /&gt;
  &lt;/rule&gt;
  </code></pre>
  
  <h3>Complete Rewrite Rule w/ Suggestion by Emma</h3>
  
  <pre><code>&lt;rewrite&gt;
    &lt;rules&gt;           
      &lt;rule name="Product Page Redirect" stopProcessing="true"&gt;
        &lt;match url="/itemform\.aspx\?item=([A-Za-z0-9.]+)" /&gt;
        &lt;conditions&gt;
        &lt;/conditions&gt;
        &lt;action type="Redirect" url="https://newsite.com/x/product/{R:1}" appendQueryString="false" redirectType="Permanent" /&gt;
      &lt;/rule&gt;
    &lt;/rules&gt;
  &lt;/rewrite&gt;
  </code></pre>