Gabbar
Gabbar

Reputation: 4066

Sitecore language embedding and default language

The business has a requirement to always show the language in the URL for our CD sites. I did some research and set the LanguageEmbedding setting to always. This seems to work fine for non-default languages but not for English, which is the default language.

When I try to go to www.abc.com, shouldnt it change to www.abc.com/en ? Am I right to think this or is this how Sitecore will behave for default language where it won't show the language if its not an embedded links?

Thanks

Upvotes: 0

Views: 1239

Answers (2)

Richard Seal
Richard Seal

Reputation: 4266

OOTB that is the way that Sitecore works. When you have LanguageEmbedding="always" - the links should all be generated with the language embedded - including for en, so a link to the home page would be www.abc.com/en - but if you just visit the domain - www.abc.com - Sitecore then uses either the language cookie stored from your last visit, or the default language.

If you want the behavior to be that if you visit www.abc.com the user is always it would be better to set that up using an IIS Redirect or a rewrite .

Upvotes: 1

Jim Noellsch
Jim Noellsch

Reputation: 714

When Sitecore determines your language via browser preference, cookie, URL slug, or query string, it will not redirect to that preferred URL structure with language slug.

You can either create a redirect module (i.e. if language context set, make correct URL and redirect) or write out <link langref=""> tags, which is an SEO best practice anyways.

Upvotes: 2

Related Questions