-
Notifications
You must be signed in to change notification settings - Fork 126
Language Domains
RealURL allows to have a domain per language with a special configuration also known as _DOMAINS
configuration.
_DOMAINS
entry is set up on the top level of RealURL configuration and it is global for all sites in the installation.
With language domains you can set up a site that runs on a certain home page to use separate domains for each defined language. You can do it for any number of root pages.
There is an important limitation: for the specific root page you can either use language domains or language segments. In other works you can either have something like /de/
, /fr/
, /it/
or domain.ch
, domain.fr
, domain.it
but not /de/
and domain.fr
. It is strictly one or another.
If you use language domain configuration you must follow language setup guide as if you are setting up language segments for all urls first.
Configuration is divived into decode and encode configuration and uses encode
and decode
keys correspondigly.
Encode configuration contains entries that connect language identifier to domains. For the case above with three languages and domains the configuration will look like:
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'] = [
'mysite.ch' => [
'preVars' => [
[
'GETvar' => 'L',
'valueMap' => [
'de' => 0,
'fr' => 1,
'it' => 2,
],
'noMatch' => 'bypass'
],
],
// other options follow
],
'mysite.fr' => 'mysite.ch',
'mysite.it' => 'mysite.ch',
'_DOMAINS' => [
'encode' => [
[
'GETvar' => 'L',
'value' => '0',
'urlPrepend' => 'https://mysite.ch/',
'useConfiguration' => 'mysite.ch',
],
[
'GETvar' => 'L',
'value' => '1',
'urlPrepend' => 'https://mysite.fr/',
'useConfiguration' => 'mysite.fr',
],
[
'GETvar' => 'L',
'value' => '2',
//'rootpage_id' => 33,
'urlPrepend' => 'https://mysite.it/',
'useConfiguration' => 'mysite.it',
],
],
// decode configuration follows
],
];
Each block always contain listed four entries with GETvar
always being L
, value
set to the language id (same in config.sys_language_uid
). useConfiguration
shows what RealURL configuration entry to use. urlPrepend
tells what to prepend to the generated URLs.
While you may try to use something other than L
for separate domain configuration, this will fail. Only language is currently supported for the multidomain configuration.
You can also use rootpage_id
option for each block if you have multiple root pages in the installation.
Warning! In the past there was an option named ifDifferentToCurrent
. Do not use this option with RealURL 2 or newer because it will produce unexpected results when encoding URLs for the current domain.
Decode configuration helps to resolve host to the actual domain. Here is how it looks like:
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'] = [
// ...
'_DOMAINS' => [
// ...
'decode' => [
'mysite.ch' => [
'GETvars' => [
'L' => 0,
],
'useConfiguration' => 'mysite.ch',
],
'mysite.fr' => [
'GETvars' => [
'L' => 1,
],
'useConfiguration' => 'mysite.fr',
],
'mysite.it' => [
'GETvars' => [
'L' => 2,
],
'useConfiguration' => 'mysite.it',
],
],
],
];
For the compatibility with future versions you must not more than one GETvar
in the decode configuration.
It is planned to change the configuration in future to look like this:
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'] = [
// ...
'_DOMAINS' => [
'mysite.ch' => [
'sys_language_uid' => 0,
'urlPrepend' => 'https://mysite.ch/',
'useConfiguration' => 'mysite.ch',
],
'mysite.fr' => [
'sys_language_uid' => 1,
'urlPrepend' => 'https://mysite.fr/',
'useConfiguration' => 'mysite.fr',
],
'mysite.it' => [
'sys_language_uid' => 2,
'urlPrepend' => 'https://mysite.it/',
'useConfiguration' => 'mysite.it',
],
],
];
Keys will contain domain names.
The change will be announced in advance. Most likely old configurations will continue to work as well.