There are at least two ways to accomplish this:
1. Allow “+” in item name via a configuration change
For this you will need to adjust the regular expression in the “ItemNameValidation” setting in web.config and make sure + sign is not present in the “InvalidItemNameChars” setting.
2. Rely on the display name instead.
I personally like this approach better where you don’t need to adjust item naming rules and at the same time leverage the flexibility provided in Sitecore CMS 6.x by the dynamic link management component called “Link Manager”:
<linkManager defaultProvider="sitecore"> <providers> <clear /> <add name="sitecore" type="Sitecore.Links.LinkProvider, Sitecore.Kernel" addAspxExtension="true" alwaysIncludeServerUrl="false" encodeNames="true" languageEmbedding="asNeeded" languageLocation="filePath" shortenUrls="true" useDisplayName="true" /> </providers> </linkManager>
In addition to the tricks describe here and here, you can instruct Sitecore to leverage item display names instead of item names for URLs by just flipping the “useDisplayName” parameter to “true”. This parameter is also extremely useful for multilingual sites.
Now you can change the display name of the NewsEvents item to “News+Events” and have a plus in your URL.
While everything looks great, it turned out that the request for http://localhost/news+events.aspx was failing with the error below:
Server Error in '/' Application.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927
The error stack trace hinted that this is somewhere at the high level, when Sitecore’s processing is not triggered yet.
After some research on the web, I’ve found that the problem is actually related to IIS, specifically IIS7’s security filtering module which does not allow double-escaped URLs. The following configuration change addresses the problem:
<system.webServer> <security> <requestFiltering allowDoubleEscaping="true" /> </security> </system.webServer>That's it, folks!