Thursday, 13 February 2014

Disable Language Code embedding in URLs in Sitecore

Leave a Comment
By default, Sitecore organize and classify contents based on the language. A page can be accessed by using several URLs in Sitecore. Below URLs are pointing to same page: 

You can observe that sometimes language code get embedded in the page URL.

For example:

Notice language code “en” (english) in the URL. If you look at the content tree in Sitecore, you won’t find any “en” node in content tree. Instance of such URLs are mainly seen in multi-site environment and may be affect adversely on SEO. Language code embedded URLs can also confuse various statistical and analytics tool like Google Analytics or Adobe Omniture Site Catalyst. Analytics data is collected per URL basis from javascripts inserted on the page. Analytics tools consider them as separate URLs (for example: URL without en and URL with en will be considered as two different pages). Thus it will be difficult to get total number of hits on particular page content.  

You can disable language code embedding by modifying linkManager provider settings in web.config. You can find below default settings in web.config:
<linkManager defaultProvider="sitecore">
    <clear />
    <add name="sitecore" type="Sitecore.Links.LinkProvider, Sitecore.Kernel"
         useDisplayName="false" />
The inclusion of language code in URL depends on below setting:

There are three options available for languageEmbedding:
  1. asNeeded : This is default option (not recommended).
  2. always : This will include language code in URL
  3. never : This will not include language code in URL
Set languageEmbedding="never" to disable language code embedding in Sitecore.

Comments and suggestions are most welcome. Happy coding!  


Post a Comment