[TYPO3-english] realurl multi domain - multi languages with subdomains
Sebastian Schöberl
dajak at gmx.net
Fri Jan 27 10:14:16 CET 2012
Hi list,
I hope this is the right place to ask the following question. If not please give me a hint where to ask.
Typo3: 4.5.7
Realurl: 1.11.2
Last night I tried to get a multi domain, multi language, singlee tree configuration including subdomains working. It seems a bit tricky and any hint and help would be appreciated!
First have a look at my example page tree:
- Homepage (UID 1)
|-- travel (UID 2)
| |-- pages ...
|
|-- informations (UID 50)
| |-- pages ...
| |-- region1 (UID 100)
| |-- region2 (UID 101)
| |-- region3 (UID 102)
|
|-- Company (200)
| |-- pages ...
|
|-- Projects (300)
| |-- pages ...
|
|-- Image database (400)
|-- pages ...
All pages are translated in english and german, so far no problem with one domain for english and another for german.
But I should use the following domains:
www.domain-german.de and www.domain-english.com for Homepage(1), Informations(50), Company(200) and Projects(300)
reisen.domain-german.de and travel.domain-english.com for travel(2)
region1.domain-german.de and region1.domain-english.com for region1(100) (within information(50) subtree)
region2.domain-german.de and region2.domain-english.com for region2(100) (within information(50) subtree)
region3.domain-german.de and region3.domain-english.com for region3(100) (within information(50) subtree)
bilder.domain-german.de and images.domain-english.com for Image database(400)
optionally if possible: projects.domain-german.de BUT www.domain-english.com for Company(200)
So I got 6 different domains for each language and configured my realurlconf to match those. I configured the domains at the coresponding pages, set them as page root and created a working root template. Decoding seems to work - without the optional part. BUT at creating links, the encoding seems to mess up the configuration. With my realurl configuration (seee end of message) I get all german language links prefixed with 'http://reisen.domain-german.de', and all english language links prefixed with 'http://travel.domain-english.com'; breaking this way most of the links.
Digging into tx_realurl->adjustConfigurationByHostEncode() it looks like the first configuration disposal with matching GETvar is used, without taking the useConfiguration and its rootpage_id into account. I just added following hack to work around this problem. My question is: Is it possible to do what I want to do without hacking bad stuff into the realurl extension?
----- line 2301 -------
if (!isset($disposal['ifDifferentToCurrent']) || $disposal['value'] != $currentValue) {
if (isset($disposal['useConfiguration'])) {
$extConf = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'];
$sys_page = t3lib_div::makeInstance("t3lib_pageSelect");
$rootLine = $sys_page->getRootLine($params['args']['page']['uid']);
$rootLine_uids = array();
foreach($rootLine as $entry) {
$rootLine_uids[] = $entry['uid'];
}
if( !in_array($extConf[$disposal['useConfiguration']]['pagePath']['rootpage_id'], $rootLine_uids)){ continue;
}
----------------
Thanks in advance,
Sebastian
------------- EXAMPLE CONFIGURATION - REALURL.CONF ----------------
$TYPO3_CONF_VARS['EXTCONF']['realurl'] = array(
'www.domain-english.com' => $tx_realurl_config,
'www.domain-german.de' => $tx_realurl_config,
'travel.domain-english.com' => $tx_realurl_config,
'reisen.domain-german.de' => $tx_realurl_config,
'projects.domain-german.de' => $tx_realurl_config,
......
);
$TYPO3_CONF_VARS['EXTCONF']['realurl']['www.domain-english.com']['pagePath']['rootpage_id'] = 1;
$TYPO3_CONF_VARS['EXTCONF']['realurl']['www.domain-german.de']['pagePath']['rootpage_id'] = 1;
$TYPO3_CONF_VARS['EXTCONF']['realurl']['reisen.domain-german.de']['pagePath']['rootpage_id'] = 2;
$TYPO3_CONF_VARS['EXTCONF']['realurl']['travel.domain-english.com']['pagePath']['rootpage_id'] = 2;
$TYPO3_CONF_VARS['EXTCONF']['realurl']['projects.domain-german.de']['pagePath']['rootpage_id'] = 200;
......
/* L=1 for german; L=2 for english*/
$TYPO3_CONF_VARS['EXTCONF']['realurl']['_DOMAINS'] = array(
'encode' => array(
array(
'GETvar' => 'L',
'value' => '1',
'useConfiguration' => 'reisen.domain-german.de',
'urlPrepend' => 'http://reisen.domain-german.de'
),
array(
'GETvar' => 'L',
'value' => '2',
'useConfiguration' => 'travel.domain-english.com',
'urlPrepend' => 'http://travel.domain-english.com'
),
.........
array(
'GETvar' => 'L',
'value' => '1',
'useConfiguration' => 'www.domain-german.de',
'urlPrepend' => 'http://www.domain-german.de'
),
array(
'GETvar' => 'L',
'value' => '2',
'useConfiguration' => 'www.domain-english.com',
'urlPrepend' => 'http://www.domain-english.com'
),
),
'decode' => array(
'reisen.domain-german.de' => array(
'GETvars' => array(
'L' => '1',
),
'useConfiguration' => 'reisen.domain-german.de'
),
.........
'www.domain-german.de' => array(
'GETvars' => array(
'L' => '1',
),
'useConfiguration' => 'www.domain-german.de'
),
),
);
More information about the TYPO3-english
mailing list