Search code examples
typo3typo3-8.xrealurl

Multidomain realurl configuration in postVarSet


I have a TYPO3 using 8.7.22 version. It's a muldomain website, and here's what the domains look like :

website.com/domain1

website.com/domain2

website.com/domain3

website.com/domain4

Each Domain has a separated tree in TYPO3, with different domain record each.

Now, I'm trying to make realurl work with all my domains, but i got this error every time I visit:

Page Not Found Reason:

Segment "domain1" was not a keyword for a postVarSet as expected on page with id=1.

To be honest, I have absolutely no idea how to define the domains in the postVarSet section. Here's my current realurl configuration:

<?php
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['_DEFAULT'] = array(
    'init' => array(
        'appendMissingSlash' => 'ifNotFile,redirect',
        'emptyUrlReturnValue' => '/',
    ),
    'pagePath' => array(
        'rootpage_id' => '1',
    ),
    'fileName' => array(
        'defaultToHTMLsuffixOnPrev' => 0,
        'acceptHTMLsuffix' => 1,
        'index' => array(
            'print' => array(
                'keyValues' => array(
                    'type' => 98,
                ),
            ),
        ),
    ),
);

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['website.com/domain1'] = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['_DEFAULT'];

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['website.com/domain2'] = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['_DEFAULT'];

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['website.com/domain2']['pagePath']['rootpage_id'] = '274';

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['website.com/domain3'] = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['_DEFAULT'];

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['website.com/domain3']['pagePath']['rootpage_id'] = '256';

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['website.com/domain4'] = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['_DEFAULT'];

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['website.com/domain4']['pagePath']['rootpage_id'] = '349';

Any idea?

Thanks a lot


Solution

  • Here's how i resolved the issue :

    Page:id=0
    
    |
    
    |--Main root page (domain record = website.com)
    
    |---- Root 1 (domain record = website.com/domain1)
    
    |---- Root 2 (domain record = website.com/domain2)
    
    |---- Root 3 (domain record = website.com/domain4)
    
    |---- Root 4 (domain record = website.com/domain3)
    

    In all root pages, including the main root page, i checked the "Use as Root Page" option, and created a template for a new website.

    And finally, put this typoscript code in all roots:

    config.typolinkEnableLinksAcrossDomains = 1
    
    config.absRefPrefix = /
    
    config.tx_realurl_enable = 1