Enable special characters in URL Segment

  • Updated

There's a default validation for URL Segment when a page is created which replaces special characters with the normal ones (for example ä becomes “a”). In some cases, clients want to keep those special characters in the URLs for their non-English versions of the web site.


.NET Core (CMS 12+) Steps

Add the following to startup.cs

var validChars = "ü ö ä ß ó ñ á á é í ó ő ú ü ñ";            
services.Configure<UrlSegmentOptions>(config => {
config.SupportIriCharacters = true;
    config.ValidCharacters = @"A-Za-z0-9\-_~\.\$" + validChars;
});


.Net Framework (CMS 11) Steps
Create a custom UrlSegment module which overrides the default URL validation. Here's an example (UrlSegmentConfigurationModule.cs):

URL-Code.PNG

After that add the following key to the appSettings section in the Web.config file.

    <add key="ValidUrlChars" value="ü ö ä ß" /> 

 

Small effort but good result:

URL-validation-sv.PNG

URL-Browser-sv.PNG