Remove Trailing Slash From the URLs

  • Updated

IIS URL rewrite module for removing Trailing Slash From the URLs do not work in CMS edit mode, page collapses and show error "too many redirects".


Add below rewrite rule for trailing-slash in web config. 

<rule name="Remove trailing slash" stopProcessing="true">
<match url="(.*)/$"/>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
<add input="{URL}" matchType="Pattern" pattern="(.*)(EPiServer)(.*)" ignoreCase="true" negate="true" />
<action type="Redirect" redirectType="Permanent" url="{R:1}"/>

 Above condition (in bold) will ignore CMS admin module URL from removing trailing-slash rule.