The regex's in the rules:
<match url="(.*[^/])$" />
and
<match url=".*[A-Z].*"
need to be modified to ignore URL's starting with /episerver and /util.
I'm no regex guru so I am afraid you will have to work that one out for yourself...
David
yes thanks...
i have now this.. and that works good. Only can someone help how i can chain these two.. I'm no expert in rewrite rules.
<rule name="Add trailing slash" stopProcessing="true"> <match url="(.*[^/])$" /> <conditions> <add input="{URL}" pattern="^/episerver" ignoreCase="true" negate="true" /> <add input="{URL}" pattern="^/util" ignoreCase="true" negate="true" /> <add input="{URL}" pattern="\.+" negate="true" /> </conditions> <action type="Redirect" redirectType="Permanent" url="{R:1}/" /> </rule> <rule name="Convert to lower case" stopProcessing="true"> <match url=".*[A-Z].*" ignoreCase="false" /> <conditions> <add input="{URL}" pattern="^/episerver" ignoreCase="true" negate="true" /> <add input="{URL}" pattern="^/util" ignoreCase="true" negate="true" /> <add input="{URL}" pattern="\.+" negate="true" /> </conditions> <action type="Redirect" url="{ToLower:{R:0}}" redirectType="Permanent" /> </rule>
Hello Vishal
From memory the first matching rule is applied when applying the rule. So they should be chained together as the first rule will be checked then redirect applied and potentialy match the second rule.
However the best way to chain the rules would be to combine into a "Add trailing slash AND Convert to lower case" rule. Some pseduo code like this:
<rule name="Add trailing slash AND Convert to lower case" stopProcessing="true">
<match url="(.*[A-Z].*)|((.*[^/])$)" ignoreCase="false" /> << Need to write regex to check for check for upper case OR URLs that don't end with "/"
<conditions>
<add input="{URL}" pattern="^/episerver" ignoreCase="true" negate="true" />
<add input="{URL}" pattern="^/util" ignoreCase="true" negate="true" />
<add input="{URL}" pattern="\.+" negate="true" />
</conditions>
<action type="Redirect" url="{ToLower:{R:0}}/" redirectType="Permanent" />
</rule>
David
Hi Guys,
i have 2 IIS rewrite rules added for adding trailing slash and for changing uppercase letters in url to lowercase.. like so.
Everything works in de front-end, but opening the CMS, it breaks.
Opening fiddler is get all 404 on resources starting with episerver/ and utils/ ... because they are adding / to the end of the resource url.
I'm new to rewrite rules.. But how can i update to ignore those requests in my rules.