IIS Redirect URL Query String to lowercase

45 Views Asked by At

I have the redirect for the URL portion working, but the Query String is not changed. How do I redirect the ENTIRE URL to lower case? https://dummyURL.com?Query=FOO to https://dummyurl.com?query=foo

Currently I have this:

<rule name="Convert to lower case" stopProcessing="true">
  <match url=".*[A-Z].*" ignoreCase="false" />
  <action type="Redirect" url="{ToLower:{R:0}}" redirectType="Permanent" />
</rule>

Any assistance would be most helpful This is a Windows 10 application and is a showstopper

1

There are 1 best solutions below

2
samwu On

You can use this example as a reference:

<rule name="URL Lower" enabled="true" stopProcessing="true">
  <match url="(.*)" ignoreCase="false" />                        
    <conditions trackAllCaptures="true">
      <add input="{QUERY_STRING}" pattern="(.*)" /> 
      <add input="{QUERY_STRING}" pattern=".*[A-Z].*" ignoreCase="false" />
    </conditions>
  <action type="Redirect" url="{ToLower:{URL}}?{ToLower:{C:0}}" appendQueryString="false" />
</rule>