Search code examples
typo3realurl

TYPO3's realurl in multi domain environment


Realurl generates the page URIs from the page title. In a multidomain environment there happen to be some pages with the same title, like "contact" or "imprint". It seems as if realurl cannot discriminate those URLs:

http://www.domain1.com/contact/ http://www.domain2.com/contact/

They always lead to the first URL found in the realurl database table, in the example above "http://www.domain1.com/contact/". Is there a way to avoid this?

This is the reaurl configuration:

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']=array(
    '_DEFAULT' => array(
        'init' => array(
            'appendMissingSlash' => 'ifNotFile,redirect',
            'emptyUrlReturnValue' => '/',
        ),
        'pagePath' => array(
            'rootpage_id' => '123',
        ),
        'fileName' => array(
            'defaultToHTMLsuffixOnPrev' => 0,
            'acceptHTMLsuffix' => 1,
            'index' => array(
                'print' => array(
                    'keyValues' => array(
                        'type' => 98,
                    ),
                ),
            ),
        ),
    ),
    'www.domain1.de' => '_DEFAULT',
    'domain1.de' => 'www.domain1.de',
    'www.domain2.de' => '_DEFAULT',
    'www.domain2.de' => array(
        'pagePath' => array(
            'rootpage_id' => '456',
        ),
    ),
    'domain2.de' => 'www.domain2.de',
);

Solution

  • This is the correct snytax:

    $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['_DEFAULT'] = array(
        'init' => array(
            'appendMissingSlash' => 'ifNotFile,redirect',
            'emptyUrlReturnValue' => '/',
        ),
        'pagePath' => array(
            'rootpage_id' => '123',
        ),
        'fileName' => array(
            'defaultToHTMLsuffixOnPrev' => 0,
            'acceptHTMLsuffix' => 1,
            'index' => array(
                'print' => array(
                    'keyValues' => array(
                        'type' => 98,
                    ),
                ),
            ),
        ),
    );
    $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['www.domain1.tld'] = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['_DEFAULT'];
    $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['domain1.tld'] = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['www.domain1.tld'];
    
    $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['www.domain2.tld'] = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['_DEFAULT'];
    $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['www.domain2.tld']['pagePath']['rootpage_id'] = '456';
    $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['domain2.tld'] = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['www.domain2.tld'];
    

    The current realurl configuration can be found with the module "Configuration" -> $GLOBALS['TYPO3_CONF_VARS'. There it can be checked whether the realurl configuration file does what it is supposed to do.