Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable language embedding in URLs in Sitecore?

After setting up a simple Sitecore site, links to pages sometimes contain the current language:

http://example.com/item.aspx
http://example.com/en/item.aspx

I would like to disable this behavior so that all links point to http://example.com/item.aspx without the language as part of the path. How can this be done?

like image 229
zzzzBov Avatar asked Feb 15 '13 21:02

zzzzBov


2 Answers

The web.config has a configuration setting for <linkManager> where the languageEmbedding option can be configured:

<linkManager defaultProvider="sitecore">
    <providers>
        <clear/>
        <add name="sitecore" ... languageEmbedding="asNeeded" ... />
    </providers>
</linkManager>

The languageEmbedding options are:

  • asNeeded
  • always
  • never

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.

like image 152
zzzzBov Avatar answered Oct 26 '22 03:10

zzzzBov


You should not use the "asNeeded" option as it might cause multiple urls for the same pages. Use either "never" or "always" which is much more SEO-friendly

like image 11
Dražen Janjiček Avatar answered Oct 26 '22 04:10

Dražen Janjiček