[TYPO3] RealUrl, multidomain, multilanguage, single tree setup 2

Tomi Hrovatin tomi at tri-ex.si
Mon Dec 3 17:29:09 CET 2007


Tomas, you're the man!

That did the trick. Thank you all for your answers.

Here is the 'working' setup for realurl, multidomain, multilanguage, 
singletree setup. :)
Note that there is also a little trick to get rid of backpid and chash 
in tt_products (thanks to Xxtobi from typo3.net)

***************************************
Realurl localconf.php setup (you can put this in realurl_autoconf.php as 
well):
***************************************

$TYPO3_CONF_VARS['EXTCONF']['realurl']['www.eksotika.si'] = array(
     'init' => array (
         'enableCHashCache' => 1,
         'appendMissingSlash' => 'ifNotFile',
//		  'adminJumpToBackend' => true,
		  'rootPageID' =>  2,
         'enableUrlDecodeCache' => true,
         'enableUrlEncodeCache' => true,
			'emptyUrlReturnValue' => true,
     ),

     'redirects' => array (
     ),

     'pagePath' => array (
         'type' => 'user',
         'userFunc' => 
'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
         'spaceCharacter' => '-',
         'languageGetVar' => 'L',
         'expireDays' => 3,
         'rootpage_id' => 2,
     ),
     'fixedPostVars' => array(),
     'postVarSets' => array(
         '_DEFAULT' => array(
             //tt_news
             // archive
             'p' => array(
                 array(
                     'condPrevValue' => -1,
                     'GETvar' => 'tx_ttnews[pS]' ,
                     'valueMap' => array(
                     )
                 ),
                 array(
                     'GETvar' => 'tx_ttnews[pL]' ,
                     'valueMap' => array(
                     )
                 ),
                 array(
                     'GETvar' => 'tx_ttnews[arc]' ,
                     'valueMap' => array(
                         'archived' => 1,
                         'non-archived' => -1,
                     )
                 ),
             ),
             // pagebrowser
             'pb' => array(
                 array(
                     'GETvar' => 'tx_ttnews[pointer]',
                 ),
             ),
				// category
             's' => array (
                 array(
                     'GETvar' => 'tx_ttnews[cat]',
                     'lookUpTable' => array(
                         'table' => 'tt_news_cat',
                         'id_field' => 'uid',
                         'alias_field' => 'title',
                         'addWhereClause' => ' AND NOT deleted',
                         'useUniqueCache' => 1,
                         'useUniqueCache_conf' => array(
                             'strtolower' => 1,
                         ),
                     ),
                 ),
             ),
				// news item
             'rastline' => array(
                 array(
                     'GETvar' => 'tx_ttnews[backPid]',
                 ),
                 array(
                     'GETvar' => 'tx_ttnews[tt_news]',
                     'lookUpTable' => array(
                         'table' => 'tt_news',
                         'id_field' => 'uid',
                         'alias_field' => 'title',
                         'addWhereClause' => ' AND NOT deleted',
                         'useUniqueCache' => 1,
                         'useUniqueCache_conf' => array(
                             'strtolower' => 1,
                             'spaceCharacter' => '-',
                         ),
                     ),
                 ),
                 array(
                     'GETvar' => 'tx_ttnews[swords]'
                 ),
             ),
// products
'rastlina' => array(
         array(
                 'GETvar' => 'tx_ttproducts_pi1[product]',
                 'lookUpTable' => array(
                         'table' => 'tt_products',
                         'id_field' => 'uid',
                         'alias_field' => 'title',
                         'addWhereClause' => ' AND NOT deleted',
                         'useUniqueCache' => 1,
                         'useUniqueCache_conf' => array(
                                 'strtolower' => 1,
                                 'spaceCharacter' => '-',
                         ),
                 ),
         ),
			array (
            'GETvar' => 'tx_ttproducts_pi1[backPID]',
            'valueMap' => array(
                 'dummy' => '1',
            ),
            'noMatch' => 'null',
         ),
),
         ),
     ),
        'fileName' => array (

             'defaultToHTMLsuffixOnPrev' => true,
             'index' => array (
                 'rss.xml' => array (
                     'keyValues' => array (
                         'type' => '100',
                     ),
                 ),
                 'rss091.xml' => array (
                     'keyValues' => array (
                         'type' => '101',
                     ),
                 ),
                 'rdf.xml' => array (
                     'keyValues' => array (
                         'type' => '102',
                     ),
                 ),
                 'atom.xml' => array (
                     'keyValues' => array (
                         'type' => '103',
                     ),
                 ),
             ),
         ),
);
$TYPO3_CONF_VARS['EXTCONF']['realurl']['www.rare-exotic-plants.com'] = 
$TYPO3_CONF_VARS['EXTCONF']['realurl']['www.eksotika.si'];
$TYPO3_CONF_VARS['EXTCONF']['realurl']['www.rare-exotic-plants.com']['postVarSets']['_DEFAULT'] 
= array(
             //tt_news
             // archive
             'p' => array(
                 array(
                     'condPrevValue' => -1,
                     'GETvar' => 'tx_ttnews[pS]' ,
                     'valueMap' => array(
                     )
                 ),
                 array(
                     'GETvar' => 'tx_ttnews[pL]' ,
                     'valueMap' => array(
                     )
                 ),
                 array(
                     'GETvar' => 'tx_ttnews[arc]' ,
                     'valueMap' => array(
                         'archived' => 1,
                         'non-archived' => -1,
                     )
                 ),
             ),
             // pagebrowser
             'pb' => array(
                 array(
                     'GETvar' => 'tx_ttnews[pointer]',
                 ),
             ),
				// category
             's' => array (
                 array(
                     'GETvar' => 'tx_ttnews[cat]',
                     'lookUpTable' => array(
                         'table' => 'tt_news_cat',
                         'id_field' => 'uid',
                         'alias_field' => 'title',
                         'addWhereClause' => ' AND NOT deleted',
                         'useUniqueCache' => 1,
                         'useUniqueCache_conf' => array(
                             'strtolower' => 1,
                         ),
                     ),
                 ),
             ),
				// news item
             'plants' => array(
                 array(
                     'GETvar' => 'tx_ttnews[backPid]',
                 ),
                 array(
                     'GETvar' => 'tx_ttnews[tt_news]',
                     'lookUpTable' => array(
                         'table' => 'tt_news',
                         'id_field' => 'uid',
                         'alias_field' => 'title',
                         'addWhereClause' => ' AND NOT deleted',
                         'useUniqueCache' => 1,
                         'useUniqueCache_conf' => array(
                             'strtolower' => 1,
                             'spaceCharacter' => '-',
                         ),
                     ),
                 ),
                 array(
                     'GETvar' => 'tx_ttnews[swords]'
                 ),
             ),




'plant' => array(
         array(
                 'GETvar' => 'tx_ttproducts_pi1[product]',
                 'lookUpTable' => array(
                         'table' => 'tt_products',
                         'id_field' => 'uid',
                         'alias_field' => 'title',
                         'addWhereClause' => ' AND NOT deleted',
                         'useUniqueCache' => 1,
                         'useUniqueCache_conf' => array(
                                 'strtolower' => 1,
                                 'spaceCharacter' => '-',
                         ),
                 ),
         ),
			array (
            'GETvar' => 'tx_ttproducts_pi1[backPID]',
            'valueMap' => array(
                 'dummy' => '1',
            ),
            'noMatch' => 'bypass',
         ),
),
);
$TYPO3_CONF_VARS['EXTCONF']['realurl']['www.rare-exotic-plants.com']['preVars'] 
= array (
                 array (
                   'GETvar' => 'L',
                   	'valueMap' =>
							array (
								'dummy' => '10',
                      ),
							'noMatch' => 'bypass',
                 ),
);

***************************************
Put this at the end of localconf.php:
***************************************

if(preg_match('/rare-exotic-plants\.com/', $_SERVER["HTTP_HOST"])) {
   $_GET['L'] = 1;
//} else if(preg_match('/german_domain\.de/', $_SERVER["HTTP_HOST"])) {
//  $_GET['L'] = 2;
} // else $_GET['L'] is not set, so it's default, Slovenian

***************************************
Typoscript setup:
***************************************

# TS for languages

config.linkVars = L
config.uniqueLinkVars = 1

[globalString = IENV:HTTP_HOST = *eksotika.si]
config {
   language=si
   sys_language_uid = 0
   locale_all = sl_SI
   htmlTag_langKey = si
}
[end]
[globalString = IENV:HTTP_HOST = *rare-exotic-plants.com]
config {
   language=en
   sys_language_uid = 1
   locale_all = en_US
   htmlTag_langKey = en
}
[end]
[global]

############# enable realUrl *********************
config.simulateStaticDocuments = 0
config.baseURL = {$website.baseUrl} # change this to current domain
config.tx_realurl_enable = 1
config.prefixLocalAnchors = all


That's it.

thanks again,
Tomi Hrovatin


Tomas Mrozek wrote:
> 1. If your site is showing different language content despite the 
> TypoScript condition then your problem is in your TypoScript setup and 
> it wouldn't work even without RealURL, as Dmitry pointed out.
> 
> 2. You don't want preVars in your URLs since you want to choose language 
> according to domain, not the preVar. Therefore, there's no need to 
> definy preVars for RealURL in the localconf.php.
> 
> 3. You most probably need to have set $_GET['L']. Otherwise, RealURL 
> will create links from page titles of default language. Therefore, 
> SOMETHING must set the variable.
> I am not sure what would be a good approach. I used to solve it by 
> adding folowing to the localconf.php:
> 
> if(preg_match('/english_domain\.com/', $_SERVER["HTTP_HOST"])) {
>   $_GET['L'] = 1;
> } else if(preg_match('/german_domain\.de/', $_SERVER["HTTP_HOST"])) {
>   $_GET['L'] = 2;
> } // else $_GET['L'] is not set, so it's default, Slovenian
> 
> Tomas Mrozek


More information about the TYPO3-english mailing list