"The value of a man should be seen in what he gives and not in what he is able to receive"

― Albert Einstein ―

How to change the Sitecore behavior to resolve relative URLs with the language keywords to Sitecore Items?

How to change the Sitecore behavior to resolve relative URLs with the language keywords to Sitecore Items?

Sitecore URL includes HR language keyword

So if you have a language keyword in your url "https://mysitecoreinstance/hr" then Sitecore will resolve this keyword, "hr" as the language if it's a registered Language in Sitecore. In order to resolve this issue, you can change Sitecore Setting configuration and set the StripLanguage to false. This settings is under the Settings node in the main Sitecore.config file under App_Config file. 

Languages.AlwaysStripLanguage Settings
Languages.AlwaysStripLanguage


Do not replace the value directly on the Sitecore.Config file but patch the file instead. You can create a new config file and place it in the App_Config>Include folder with the following Patch settings. We will be replacing the value from default value "true" to "false". I name my config patch file: "MyProject.Website.Settings.Languages.AlwaysStripLanguage.config"


<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <settings>
      <setting name="Languages.AlwaysStripLanguage" value="false"/>
    </settings>
  </sitecore>
</configuration>


When you view your configuration file, you will see that the original settings are replaced by your patch config file.


Languages.AlwaysStripLanguage