Sitecore Multi language site with the language code in the URL Gotcha

One of the many ways Sitecore will allow you to specify a language is in the url

eg – English Language Site – French Language Site

I came across a gotcha that had me stumped for a while.

To configure Sitecore to include the language code in the url, requires a change to the LinkManager in sitecore.config

<linkManager defaultProvider="sitecore">
  <clear />
  <add name="sitecore" type="Sitecore.Links.LinkProvider, Sitecore.Kernel"
    useDisplayName="false" />

What needs to be changed is languageEmbedding. This needs to be altered from asNeeded to always
As we don’t alter the web.config to make Sitecore upgrades easier, create a Sitecore patch file to make the modification

        <add name="sitecore">
          <patch:attribute name="languageEmbedding">always</patch:attribute>

All done. the language code of the selected language is now included in the url.


When you download the latest version of Sitecore, (currently version 8) and follow the instructions to create a Visual Studio solution you are left with default.aspx in the root of the site.

Leaving this page in a Sitecore 8 MVC based solution, was preventing the language selector from working correctly on the home page of the site.

So attempting to go to instead of loading up the configured site homepage, the default.aspx page is presented instead.

If you attempt to use the sc_lang parameter on the home page, ie, the correct home page and the language is set correctly.

After much poking around Google, and not finding a solution, I was about to create a custom pipeline to attach a debugger to the site to determine what was going on, I decided to delete default.aspx file in the site root folder.

Deleting the default.aspx file solved the problem.

Who knew that this was the problem.


My musing about anything and everything

Tagged with: , ,
Posted in Sitecore
2 comments on “Sitecore Multi language site with the language code in the URL Gotcha
  1. Anton says:

    “requires a change to the LinkManager in the web.config” I guess it is misprint, it is not in web.config, it is in sitecore.config.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 13 other subscribers
%d bloggers like this: