I have a few querystring keys ("mobile", "nomobile", etc.) that I do not want to be sent in any 301 redirect responses.
For example, let's say I have the Url /about-us
that redirects to /about
.
RewriteRule ^about-us$ /about [NC,L,R=301]
Rewrite rules by default keep querystings in the redirect Url. So for an incoming Url like this:
/about?mobile=true&xyz=1
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:
/about?xyz=1
I don't want the (mobile, nomobile
, 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 mobile
querystring. This querystring removal should happen on the Location header (i.e. destination Url) of the redirect response.
I have thousands of ISAPI RewriteRules, so I don't want to apply a RewriteCond
to every rule.
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.