We know that Sitecore is a CMS and it supports multiple languages, hence the generated URL and Sitecore links will have a language appended to it for example(‘en’,’en-US’, etc.,). In this article, we will see How to Disable Language Embedding in URLs and Sitecore Links.
Disable Language Embedding in URLs and Sitecore Links
Most of the settings of Sitecore can be done without writing any additional code. We can easily disable language embedding in Sitecore by editing web.config’s
<linkManager> section where the
languageEmbedding option can be configured.
<linkManager defaultProvider="sitecore"> <providers> <clear /> <add name="sitecore" type="Sitecore.Links.LinkProvider, Sitecore.Kernel" addAspxExtension="true" alwaysIncludeServerUrl="false" encodeNames="true" languageEmbedding="never" languageLocation="filePath" lowercaseUrls="false" shortenUrls="true" useDisplayName="false" /> </providers> </linkManager>
For your reference, the languageEmbedding options are:
- asNeeded (default)
Changing the config to use
languageEmbedding="never" will stop the language from showing up in the URL, and likewise
languageEmbedding="always" will force the language to always show up in the URL.
Note: Do not use the option “asNeeded” unless you are sure about what you are doing, as it might cause multiple URL’s for the same pages and this might affect the SEO of the site. Use either “never” or “always” which is much more SEO-friendly.