How to prevent resolving of not registered languages

  • By default Sitecore XP resolves a language from the part of the path that goes after the first forward slash symbol ( "/"):


    So, when a letter combination that matches any of the .NET Culture Codes is in that position, it gets resolved as a language (even if a language is not registered for Sitecore XP instance), and is not used to resolve anything else (for example, an alias or an item).

  • Possible ways to change the described behavior depend on the requirement to include language as a part of the URL.

    • If the specific website is not a multi-language one, and it does not require adding language code to the URL, disable the Languages.AlwaysStripLanguage setting (change its value to false) in the /App_Config/Sitecore.config file.
    • If the website is a multi-language one, and it is necessary to prevent resolving of non-defined languages, consider implementing a custom ItemLanguageResolver processor. See the following link for a code sample:

Applies to:

CMS 6+

February 26, 2020
February 26, 2020