URL segments and IDN
Configure URL segment characters and Internationalized Domain Name support in CMS 13.
URL segments control how CMS generates URL-safe strings from content names and simple addresses. By default, Optimizely restricts characters to those allowed by RFC 1738: alphabetic, numeric, -, _, ~, ., and $.
Define a custom character set by updating UrlSegmentOptions in the dependency injection container. When the character set includes characters outside RFC 1738, set UrlSegmentOptions.SupportIriCharacters to true to enable IRI encoding.
The following example configures a character set that allows Unicode letter characters:
using EPiServer.ServiceLocation;
using EPiServer.Framework.Initialization;
using EPiServer.Framework;
using EPiServer.Web;
namespace EPiServerSite {
[ModuleDependency(typeof (EPiServer.Web.InitializationModule))]
public class IRIConfigurationModule: IConfigurableModule {
public void ConfigureContainer(ServiceConfigurationContext context) {
context.Services.Configure<UrlSegmentOptions>(o => {
o.SupportIriCharacters = true;
o.ValidCharacters = @ "\p{L}0-9\-_~\.\$";
});
}
public void Initialize(InitializationEngine context) {}
public void Uninitialize(InitializationEngine context) {}
}
}UrlSegmentOptions exposes a CharacterMap property for mapping unsupported characters. For example, map 'ö' to 'o'.
Internationalized domain names (IDN)
Internationalized domain names (IDN) use Punycode format to represent Unicode characters with ASCII characters. Register internationalized domain names in Punycode format. For background, go to IDN and IRI.
Updated 17 days ago
