Hi I am using the URL Rewrite module in IIS. I would create a rule to convert lowercase urls. But, I'm having problems. My goal is to do the following:
http://www.doMain.com/App/ActIon?X=1&y=3&JJ=3... => http://www.domain.com/app/action?X=1&y=3&JJ=3...
My first failed attempt was:
<rule name="LowerCaseRule1" stopProcessing="true">
<match url="[A-Z]" ignoreCase="false" />
<action type="Redirect" url="{ToLower:{URL}}" />
</rule>
Result:
http://www.doMain.com/App/ActIon?X=1&y=3&JJ=3... => http://www.domain.com/App/ActIon?X=1&y=3&JJ=3...
it only applies to the domain (Because the URL variable has only the domain)
My second failed attempt was:
<rule name="Convert to lower case" stopProcessing="true">
<match url=".*[A-Z].*" ignoreCase="false" />
<action type="Redirect" url="{ToLower:{R:0}}" redirectType="Permanent" />
</rule>
Result:
http://www.doMain.com/App/ActIon?X=1&y=3&JJ=3... => http://www.domain.com/app/action?x=1&y=3&jj=3...
This also applies to query string. Therefore I did not serve me.
My third failed attempt was:
<rule name="Convert to lower case" stopProcessing="true">
<match url="^(.*[A-Z].*)(\/.*)" ignoreCase="false" />
<action type="Redirect" url="{ToLower:{R:1}}{R:2}" redirectType="Permanent" />
</rule>
Result:
http://www.doMain.com/App/ActIon?X=1&y=3&JJ=3... => http://www.domain.com/app/ActIon?X=1&y=3&JJ=3...
The problem this does not apply to the last path.
This causes the following rule that I need is not met:
http://www.doMain.com/App => http://www.domain.com/app
Questions:
Is there any rule that allows me to do what I need?
Is it correct to do with the module?
Because I have another alternative is to use ASP.NET routing engine (For example https://github.com/schourode/canonicalize)