title: URL Rewriting with Query Strings using IIS URL Rewrite Module
body: <p>I am trying to rewrite a url such as:</p>
  
  <pre><code>new_membership?R=1&amp;I=2
  </code></pre>
  
  <p>to:</p>
  
  <pre><code>agent_new_membership.aspx?R=1&amp;I=2
  </code></pre>
  
  <p>but I am getting an error reading: "HTTP Error 404.0 - Not Found"</p>
  
  <p>This is the web.config code I am using:</p>
  
  <pre><code>    &lt;rewrite&gt;
    &lt;rewriteMaps&gt;
      &lt;rewriteMap name="Redirects"&gt;
        &lt;add key="/administration" value="/administration_main.aspx" /&gt;
        &lt;add key="/change_admin_password" value="/admin_change_password.aspx" /&gt;
      &lt;/rewriteMap&gt;
    &lt;/rewriteMaps&gt;
  
    &lt;rules&gt;
      &lt;rule name="New Membership" stopProcessing="true"&gt;
        &lt;match url="^new_membership?R=(\d+)&amp;amp;I=(\d+)$" /&gt;
        &lt;conditions&gt;
          &lt;add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /&gt;
          &lt;add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /&gt;
        &lt;/conditions&gt;
        &lt;action type="Rewrite" url="agent_new_membership.aspx?R={R:1}&amp;amp;I={R:2}" /&gt;
      &lt;/rule&gt;
  
      &lt;rule name="Redirect rule1 for Redirects"&gt;
        &lt;match url=".*" /&gt;
        &lt;conditions&gt;
          &lt;add input="{Redirects:{REQUEST_URI}}" pattern="(.+)" /&gt;
        &lt;/conditions&gt;
        &lt;action type="Rewrite" url="{C:1}" appendQueryString="false" /&gt;
      &lt;/rule&gt;        
    &lt;/rules&gt;
  
  &lt;/rewrite&gt;
  </code></pre>
  
  <p>What am I doing wrong?</p>
  
  <p>Thanks in advance.</p>