How To Tell Search Engines About Localized Versions Of The Website When Using Firebase Hosting I18n Rewrites?

Firebase has recently announced support for the i18n rewrites feature. It allows you to serve different content depending on a user's country or preferred language.

But since the different versions of the content are served under the same URL, a search engine crawler will only be able to find one version of localized content.

Without i18n rewrites, I would need to create a root page that redirects to localized ones depending on the user's language preference or location ( redirects either to or With that approach, crawlers could easily find and index all localized versions of my website.

But how can I achieve that discoverability with i18n rewrites?



You should be able to use a combination of <link rel="alternate"> and <link rel="canonical"> for this. Firebase Hosting will still serve your localized content from the full path (e.g. if your root is /intl and someone visits /intl/fr they will see the French content regardless of headers and cookies).

The Google crawler will use local IPs from a variety of countries but no Accept-Language header when crawling (source). So my recommendation would be:

  1. In all of your pages, add <link rel="alternate" langhref="{lang}" href="{url}"> tags for each localized version, where {url} is the absolute URL to the localized version (e.g. /intl/fr/about.html).
  2. In all of your localized pages, add a <link rel="canonical" href="{url}"> that points to the full localized version. (see Google guidance)

With those tags in place, Google should be able to discover the multi-language and multi-locale content in your site.