4

I have a multi-language website and according to the Google guidelines for multi-language sites, I should keep the two or more versions of my website in two different subfolders, like:

  • www.example.com/en
  • www.example.com/it

So far so good. This way the crawler will properly index the two versions of the website and it will present search results based on the user local language.

But what should I do with the root of the website? I mean, what index.html should I put straight into

  • www.example.com

Is it required to have an index.html? Should I put a small PHP script that redirects users to the appropriate localized website? (e.g. user goes to www.example.com and gets redirected to www.example.com/en). It looks like most websites implement this automatic redirect.

3

Search engines love multiple-languages and are super flexible

Google and Bing are very flexible when it comes to structuring a website with multiple languages. The first thing you should know about these types of sites is that you can either target a language or a language + country.

Country Based Content

Targetting a country is more ideal for sites that sell services or products because then you can set the currency or have specific information on where to buy the product or service, and run country-specific promotions, a good example is https://www.samsung.com/uk/

On the root domain (https://www.samsung.com/) and within <head> I would expect to see

  • <html lang="en">
  • <link rel="alternate" href="https://www.samsung.com/uk/" hreflang="en-GB" />

Then on the URL path UK (https://www.samsung.com/uk/) I would expect to see:

  • <html lang="en-GB">
  • <link rel="alternate" href="https://www.samsung.com/" hreflang="x-default" />
  • <link rel="alternate" href="https://www.samsung.com/us/" hreflang="en-US" />

Wait a minute... what's x-default?

You may have noticed and thinking what is x-default?, this markup tells search engines, that should the site visitor not be either en-US or en-GB then the root is the default for all other unmatched languages and countries.

Okay, gotcha but what is HTML Lang?

The <html lang="en-GB"> is primarily for users, not search engines, so essentially it tells the browser what language is set to the page, ideally from an accessibility point of view, you should use both lang and hreflang.

But... I don't want to target countries, I want to target languages

Okay, chill your beans. Targetting languages is as simple as removing the country ISO, the so en-GB becomes en and URLs should be renamed from /uk/ to /en/

If you main visitors or customers are English then you can use the root domain for that language, there's no need to create /en/ since you will be telling Google and Bing on other pages the alternative for /en/ for example on page /de/ I would expect to see this:

  • <html lang="de">
  • <link rel="alternate" href="https://www.samsung.com/" hreflang="x-default" />
  • <link rel="alternate" href="https://www.samsung.com/" hreflang="en" />

However, you could also use both / and /en/ for English, both are acceptable methods. Using / for unmatched countries could be a unique page where users can pick a language, for example:

Tackling duplicate content

When using identical pages e.g (en-GB + en-US) or (x-default + en) it is important to use rel canonical to inform Google and Bing that X is duplicate of Y.

For example, if we use / /uk/ and /us/, and all pages are identical or almost identical then I would expect to see this in the head:

Root /

  • <html lang="en">
  • <link rel="alternate" href="https://www.example.com/us/" hreflang="en-US" />
  • <link rel="alternate" href="https://www.example.com/uk/" hreflang="en-GB" />
  • <link rel="canonical" href="https://example.com/" />

UK Page /uk/

  • <html lang="en-GB">
  • <link rel="alternate" href="https://www.example.com/" hreflang="x-default" />
  • <link rel="alternate" href="https://www.example.com/us/" hreflang="en-US" />
  • <link rel="canonical" href="https://example.com/" />

US Page /us/

  • <html lang="en-US">
  • <link rel="alternate" href="https://www.example.com/" hreflang="x-default" />
  • <link rel="alternate" href="https://www.example.com/uk/" hreflang="en-GB" />
  • <link rel="canonical" href="https://example.com/" />

But if you want to use /us/ to be the master, and everything else to be duplicate then you change the canonical from https://example.com/ to https://example.com/us/

Please Note

This answer contains elements outside the realms of what has been asked, primarily canonical pages and country-specific pages, this has been added as an EXTRA and to help other users that may be considering to use languages or languages + countries.

  • ok thanks for the answer. Would it be possible and Google friendly to add all the alternate links on all pages (so having 1 meta link that "alterate"s to itself on each page?) This way I could drastically reduce the PHP code and have 1 single fixed head template for all the versions – Gianluca Ghettini Nov 20 '18 at 17:33
  • That generally wouldn't work because most often the URL doesn't stop with /en/ you would have /en/contact/ /en/services/ so they would need a different url for each. You need to create a PHP solution or find a content management system or plugin that does this for you. – Simon Hayter Nov 20 '18 at 17:55
0

Where most of visitors from? For example English is most used. Make a copy of /en/ to /index.html but with proper canonical tag. So /en/ and / pages have same canonical.

  • sorry I don't follow you. Could you explain in more detail? – Gianluca Ghettini Nov 19 '18 at 21:52
  • /en/ page and root page are same, both have header <link rel="canonical" href="/en/"> This way is good for seo, googlebot will not see it as duplicate content. – LeonidMew Nov 19 '18 at 21:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.