Sitecore - rewrite " " to "-" in urls but still allow dashes as legal item names
seo, sitecore, sitecore6, url-rewriting
Solution
So, if I am assuming correctly, you want to replace spaces in item names with some other SEO-friendlier character. Whatever replacement you configure, you would need to apply the transformation on both sides of the equation (pun intended). So '--' or '_' will have to become illegal item name characters.
I generally think it's a bad idea to do this and would rather have my content editors determine the exact urls to their content.
But if you absolutely need to implement this as a rule, one of the solutions out there is to implement a custom handler to change your real item name while leaving the item display name in its original form.
Hope this helps.
Problem
I've read a half dozen guides on rewriting spaces to something more friendly in Sitecore, but all of them rely on Sitecore's `<encodeNameReplacements/>` element which also reverses the replacement requiring "-" to be an illegal character for names. The problem with this is that the url of our application has a "-" in the hostname. Sitecore rewrites this resulting in a 404. Does anyone have ideas on how to do this url rewriting in Sitecore without relying on `<encodeNameReplacements` and still allowing "-" as a legal item name character? Our current best idea is to use something slighty more complex than a plain "-" such as "--" or "_". This isn't a very good idea, so I'd appreciate any insight you guys have on the matter. EDIT: We are running a multi-site setup with Sitecore 6.5