I have a multi-language, multi-site, multi-domain TYPO3 (4.5) Instance where RealURL keeps me busy. In some sub-sites, I just can\'t get it to create the right URLs for Language
This is an obvious example of "get desperate and look for hacks instead of looking at the problem after a good night's sleep".
There were inconsistencies in the RealURL Config which provoked the erroneous behaviour.
I'm posting the hopefully fully working RealURL config. It covers two single-domain/multi-language websites as well as two multi-domain/multi-language websites. That is why I use the regex on the URL.
<?php
$TYPO3_CONF_VARS['EXTCONF']['realurl'] = array (
'_DEFAULT' => array (
'init' => array(
'enableCHashCache' => 1,
'respectSimulateStaticURLs' => 0,
'appendMissingSlash' => 'ifNotFile',
'enableUrlDecodeCache' => 1,
'enableUrlEncodeCache' => 1,
),
'preVars' => array(
array(
'GETvar' => 'L',
'valueMap' => array(
'de' => '0',
'fr' => '1',
'it' => '2',
),
'valueDefault' => 'de',
'noMatch' => 'bypass',
),
array(
'GETvar' => 'no_cache',
'valueMap' => array(
'no_cache' => 1,
),
'noMatch' => 'bypass',
),
),
'pagePath' => array (
'rootpage_id' => 1,
'type' => 'user',
'disablePathCache' => 0,
'userFunc' =>
'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'spaceCharacter' => '-',
'languageGetVar' => 'L',
'expireDays' => 3
),
'fileName' => array(
'defaultToHTMLsuffixOnPrev' => 0,
),
),
);
/* site1 and site2 are single-domain */
/* site3 */
# http://blog.teamgeist-medien.de/2013/09/hardcore-realurl-mehrere-domains-prevars-sprachen-rootpages-decodeencode.html
if ( preg_match('/(www\.)?site3-d\.ch/', $_SERVER['HTTP_HOST']) > 0
|| preg_match('/(www\.)?site3-f\.ch/', $_SERVER['HTTP_HOST']) > 0
|| preg_match('/(www\.)?site3-i\.ch/', $_SERVER['HTTP_HOST']) > 0 ) {
$TYPO3_CONF_VARS['EXTCONF']['realurl']['site3'] = $TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT'];
$TYPO3_CONF_VARS['EXTCONF']['realurl']['site3']['pagePath']['rootpage_id'] = '618';
$TYPO3_CONF_VARS['EXTCONF']['realurl']['_DOMAINS'] = array(
'encode' => array(
array(
'GETvar' => 'L',
'value' => '',
'useConfiguration' => 'site3',
'urlPrepend' => 'http://www.site3-d.ch',
),
array(
'GETvar' => 'L',
'value' => '0',
'useConfiguration' => 'site3',
'urlPrepend' => 'http://www.site3-d.ch',
),
array(
'GETvar' => 'L',
'value' => '1',
'useConfiguration' => 'site3',
'urlPrepend' => 'http://www.site3-f.ch'
),
array(
'GETvar' => 'L',
'value' => '2',
'useConfiguration' => 'site3',
'urlPrepend' => 'http://www.site3-i.ch',
),
),
'decode' => array(
'www.site3-d.ch' => array(
'GETvars' => array(
'L' => '0',
),
'useConfiguration' => 'site3',
),
'www.site3-f.ch' => array(
'GETvars' => array(
'L' => '1',
),
'useConfiguration' => 'site3',
),
'www.site3-i.ch' => array(
'GETvars' => array(
'L' => '2',
),
'useConfiguration' => 'site3',
),
),
);
}
/** site4 */
if ( preg_match('/(www\.)?site4-d\.ch/', $_SERVER['HTTP_HOST']) > 0
|| preg_match('/(www\.)?site4-f\.ch/', $_SERVER['HTTP_HOST']) > 0 ) {
// default Konfiguration übernehmen
$TYPO3_CONF_VARS['EXTCONF']['realurl']['site4'] = $TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT'];
$TYPO3_CONF_VARS['EXTCONF']['realurl']['site4']['pagePath']['rootpage_id'] = '574';
$TYPO3_CONF_VARS['EXTCONF']['realurl']['site4']['preVars'] = array();
$TYPO3_CONF_VARS['EXTCONF']['realurl']['_DOMAINS'] = array(
'encode' => array(
array(
'GETvar' => 'L',
'value' => '',
'useConfiguration' => 'site4',
'urlPrepend' => 'http://www.site4-d.ch',
),
array(
'GETvar' => 'L',
'value' => '0',
'useConfiguration' => 'site4',
'urlPrepend' => 'http://www.site4-d.ch',
),
array(
'GETvar' => 'L',
'value' => '1',
'useConfiguration' => 'site4',
'urlPrepend' => 'http://www.site4-f.ch'
),
),
'decode' => array(
'www.site4-d.ch' => array(
'GETvars' => array(
'L' => '0',
),
'useConfiguration' => 'site4',
),
'www.site4-f.ch' => array(
'GETvars' => array(
'L' => '1',
),
'useConfiguration' => 'site4',
),
),
);
}
?>