Hreflang Setup for Multilingual Website

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:
Development stages
Latest works
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    822
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    847
  • image_website-sbh_0.png
    Website development for SBH Partners
    999
  • image_website-_0.png
    Website development for Red Pear
    451

Setting up hreflang for multilingual sites

hreflang tells Google which version of a page is intended for which language and region. Without proper hreflang, search engines show incorrect language versions to users — Russian version ranks in Germany, English ranks in Russia.

Tag syntax

<!-- On each language version of the page, add ALL alternatives -->
<link rel="alternate" hreflang="ru"    href="https://example.ru/products/laptop">
<link rel="alternate" hreflang="en"    href="https://example.com/products/laptop">
<link rel="alternate" hreflang="uk"    href="https://example.ua/products/laptop">
<link rel="alternate" hreflang="de"    href="https://example.de/products/laptop">
<link rel="alternate" hreflang="x-default" href="https://example.com/products/laptop">

x-default — default version for users whose language doesn't match any specified, or for language selection page.

Regional specificity

When you need to separate by country, not just language:

<link rel="alternate" hreflang="ru-RU" href="https://example.ru/products/laptop">
<link rel="alternate" hreflang="ru-UA" href="https://example.ua/ru/products/laptop">
<link rel="alternate" hreflang="ru-KZ" href="https://example.kz/products/laptop">
<link rel="alternate" hreflang="en-US" href="https://example.com/products/laptop">
<link rel="alternate" hreflang="en-GB" href="https://example.co.uk/products/laptop">

Implementation in Laravel

// config/locales.php
return [
    'ru' => ['hreflang' => 'ru', 'domain' => 'example.ru'],
    'en' => ['hreflang' => 'en', 'domain' => 'example.com'],
    'uk' => ['hreflang' => 'uk', 'domain' => 'example.ua'],
    'de' => ['hreflang' => 'de', 'domain' => 'example.de'],
];

// In controller
public function show(string $slug): View
{
    $page = Page::where('slug->ru', $slug)
        ->orWhere('slug->en', $slug)
        ->firstOrFail();

    $hreflangs = $this->buildHreflangs($page);

    return view('page', compact('page', 'hreflangs'));
}

protected function buildHreflangs(Page $page): array
{
    $locales = config('locales');
    $hreflangs = [];

    foreach ($locales as $locale => $config) {
        $slug = $page->getTranslation('slug', $locale);
        if ($slug) {
            $hreflangs[$config['hreflang']] = 'https://' . $config['domain'] . '/' . $slug;
        }
    }

    $hreflangs['x-default'] = $hreflangs['en'] ?? reset($hreflangs);

    return $hreflangs;
}
@foreach ($hreflangs as $lang => $url)
    <link rel="alternate" hreflang="{{ $lang }}" href="{{ $url }}">
@endforeach

Hreflang in XML Sitemap

Alternative to tags in <head> — specify in sitemap. More convenient for large sites:

<url>
    <loc>https://example.ru/products/laptop</loc>
    <xhtml:link rel="alternate" hreflang="ru" href="https://example.ru/products/laptop"/>
    <xhtml:link rel="alternate" hreflang="en" href="https://example.com/products/laptop"/>
    <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/products/laptop"/>
</url>

Common mistakes

  • One-directional specification — if page A links to B as alternative, page B must link back to A
  • Non-existent URLs — hreflang with 404 or redirect is ignored
  • Different content — same content with different language hreflang is perceived as duplicates
  • Wrong language code — only ISO 639-1 for language and ISO 3166-1 Alpha-2 for country

Verification

Google Search Console → Coverage → check hreflang errors. hreflang Tags Testing Tool (Merkle SEO) lets you verify tag correctness on a page.

Setup time: 1–2 days for multilingual site with multiple domains.