SEO Friendly URLs in Sitecore – Prevention is Better than Cure
I’ve seen a fair number of posts already on SEO Friendly URLs, search engines love them apparently and as humans we love them too – although it could be argued that it is mainly for vanity reasons (go check out the product URLs on Amazon quickly…)
Whatever the argument, we agree that Semantic URLs are a good thing for us mere mortals and the vast majority of sites.
EncodeNameReplacements
The simplest way of achieving friendly URLs is by using a combination of settings. Firstly set the LinkManager
(from Sitecore 6.6 onwards) to use lowercase urls and remove the aspx extension:
<linkManager defaultProvider="sitecore"> <providers> <add name="sitecore" addAspxExtension="false" encodeNames="true" lowercaseUrls="true" ... /> </providers> </linkManager>
And then set encodeNameReplacements
to replace spaces with dashes:
<encodeNameReplacements> ... <replace mode="on" find=" " replaceWith="-" /> </encodeNameReplacements>