title: Remove specific querystrings from the location Url of a redirect response using ISAPI and IIS
body: <p>I have a few querystring keys ("mobile", "nomobile", etc.) that I do not want to be sent in any 301 redirect responses.</p>
  
  <p>For example, let's say I have the Url <code>/about-us</code> that redirects to <code>/about</code>. </p>
  
  <pre><code>RewriteRule ^about-us$ /about [NC,L,R=301]
  </code></pre>
  
  <p>Rewrite rules by default keep querystings in the redirect Url. So for an incoming Url like this: </p>
  
  <pre><code>/about?mobile=true&amp;xyz=1
  </code></pre>
  
  <p>If a redirect rule is applied, I want the server to respond with a location Url that has the mobile querystring removed from the redirect Url, but still containing the xyz querystring. So I want this request to return with this destination Url:</p>
  
  <pre><code>/about?xyz=1
  </code></pre>
  
  <p>I don't want the (<code>mobile, nomobile</code>, etc.) querystrings removed from the incoming request. If the Url results in a 200, I want the underlying ASP.NET Web applications to see the <code>mobile</code> querystring. This querystring removal should happen on the Location header (i.e. destination Url) of the redirect response.</p>
  
  <p>I have thousands of ISAPI RewriteRules, so I don't want to apply a <code>RewriteCond</code> to every rule.  </p>
  
  <p>Is there an ISAPI rule or a custom module I can put somewhere to apply this logic globally to ISAPI generated redirects or to any redirect responses coming out of IIS?  Thanks for your help.</p>