Friday, October 3, 2014

Sitecore replace spaces in URLs with dashes

Out of the box, Sitecore will display spaces in URLs which can look messy and potentially have negative SEO consequences. However it is possible to replace all of a given character or string in a URL for another. This can be used in this case to replace any occurrence of a space with a dash.

Simply open the web.config file for your Sitecore website and locate the "encodeNameReplacements" section. Here you will see all existing string replacements, and can add the following line:
<replace mode="on" find=" " replaceWith="-"/>
 In this section you could also replace underscores with dashes or potentially entire words with others.

No comments:

Post a Comment