Umbraco 12 - ToLower URL Redirect
# help-with-umbraco
j
Can anyone share a IIS Redirect rewrite rule to Lower the URL in Umbraco 12? Thanks
j
Copy code
xml
<rule name="Redirect to canonical url">
 <match url="^(.+)" /> <!-- rule back-reference is captured here -->
 <conditions>
  <!-- Check whether the requested domain is in canonical form -->
  <add input="{HTTP_HOST}" type="Pattern" pattern="^www\.mysite\.com$" negate="true" /> 
 </conditions>
 <!-- Redirect to canonical url and convert URL path to lowercase -->
 <action type="Redirect" url="http://www.mysite.com/{ToLower:{R:1}}" redirectType="Found" />
</rule>
Go careful how you implement it mind, I've never checked but I'd be surprised if there aren't case sensitivethings in the backoffice.
m
Perhaps exclude
^umbraco/
?
s
Careful also about possible querystring problem if you lowercase them. Ultimately, you're probably mostly outputting URLs using Umbraco's
.Url()
etc syntax, which will format it some way. The casing does not change unless someone manually changes it. Indexing will happen with the casing on the page, so whatever Umbraco outputs. I know some overly zealous SEO people love to advise this, but I feel that's mostly fearmongering and leads to more problems than it solves. Maybe I'm missing the point completely, so if there's another reason then I'd be happy to learn what it is.
j
Yes, IME, having a canonical URL set is more valuable as it should solve mixed capitalisation and a host of other issues.
87 Views