Skip to main content

Documentation: Domain per Language plugin

How it works

Domain per Language sits between the domain a visitor arrives on and Joomla's own multilingual routing. This article describes what it does with a request, with a link, and with the tags search engines read.

The language comes from the domain

On a configured domain the plugin sets the language of the request before the language filter runs. That order matters: without it, Joomla would pick the language from a cookie, the session or the browser, and a visitor who once chose Dutch would keep seeing Dutch on your English domain.

A page in that language is then served without its language code. A language that has no domain of its own keeps its code and is served on the domain of the default site language.

Redirects

All of these are permanent redirects (301), and none of them happen on a POST request:

  • www.example.com/en/about on the English domain becomes www.example.com/about - the language code of the domain's own language is duplicate content.
  • A page in another language moves to the domain of that language, so www.example.com/nl/over-ons becomes www.example.nl/over-ons.
  • The www or bare variant of a configured domain moves to the configured one, keeping path and query.

A host that is not configured is left completely alone. Your staging domain, localhost or an IP address therefore behaves like an ordinary multilingual Joomla site, with language codes in the URL.

Links between domains

Joomla builds links with its own router, which always keeps the host of the current request. A link to another language therefore leaves the router with a marker in its path, and the plugin turns that marker into a real absolute URL before the page reaches the visitor. You never see it; what you get is https://www.example.nl/over-ons in the menu, in the language switcher, in hreflang and in feeds.

Three layers make sure a marker never reaches a visitor: the rewrite of the finished page, a redirect for a marker URL that arrives anyway (for example from an e-mail sent by a scheduled task), and a public method other extensions can call. See the article about links in other extensions.

hreflang, x-default and the canonical

The alternate links that the language filter adds are rewritten to the domain of each language, x-default included, so search engines see one clean set of URLs per page.

The core System - SEF plugin has a Site Domain field. When it is filled in, that plugin puts the canonical of every page on that single domain, which is wrong as soon as a page lives on another language domain. Domain per Language moves such a canonical back to the domain of the page's language; only the host changes. On a host that is not configured, the behaviour of the SEF plugin is left untouched.

Caching

The plugin finishes its work before a page is stored in the cache, so a cached page already carries the right URLs. Joomla caches per full URL including the host, so each domain has its own cache entries.