Skip to content

Instantly share code, notes, and snippets.

@chriwo
Last active June 29, 2018 07:12
Show Gist options
  • Save chriwo/3512264c7c7f0d5edbf3 to your computer and use it in GitHub Desktop.
Save chriwo/3512264c7c7f0d5edbf3 to your computer and use it in GitHub Desktop.
RealUrl Multidomain setup with configuration for tx_news. You could copy & paste the code, but it's important to change line 4 and line 133. Replace the domain name and the PAGE_UID. In line 133 it's needed to replace the PAGE_UID with the page number of the detail news page.
<?php
$domainConfiguration = [
'www.first-domain.com' => PAGE_UID,
//'www.second-domain.com' => PAGE_UID,
//'www.third-domain.com' => PAGE_UID
];
$txRealUrlConfiguration = [
'init' => [
'appendMissingSlash' => 'ifNotFile'
],
'fileName' => [
'defaultToHTMLsuffixOnPrev' => true,
'index' => [
'rss.xml' => [
'keyValues' => [
'type' => '100'
]
],
'rss091.xml' => [
'keyValues' => [
'type' => '101'
]
],
'rdf.xml' => [
'keyValues' => [
'type' => '102'
]
],
'atom.xml' => [
'keyValues' => [
'type' => '103'
]
]
]
],
'pagePath' => [
'rootpage_id' => '1'
],
'preVars' => [
[
'GETvar' => 'no_cache',
'valueMap' => [
'nc' => '1'
],
'noMatch' => 'bypass'
],
[
'GETvar' => 'L',
'valueMap' => [
'en' => '1'
],
'noMatch' => 'bypass'
]
],
'fixedPostVars' => [
'newsDetailConfiguration' => [
[
'GETvar' => 'tx_news_pi1[action]',
'valueMap' => [
'detail' => ''
],
'noMatch' => 'bypass'
],
[
'GETvar' => 'tx_news_pi1[controller]',
'valueMap' => [
'News' => ''
],
'noMatch' => 'bypass'
],
[
'GETvar' => 'tx_news_pi1[news]',
'lookUpTable' => [
'table' => 'tx_news_domain_model_news',
'id_field' => 'uid',
'alias_field' => 'IF(alternative_title != "", alternative_title, title)',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => [
'strtolower' => 1,
'spaceCharacter' => '-'
],
'languageGetVar' => 'L',
'languageExceptionUids' => '',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'expireDays' => 180
]
]
],
'newsCategoryConfiguration' => [
[
'GETvar' => 'tx_news_pi1[overwriteDemand][categories]',
'lookUpTable' => [
'table' => 'sys_category',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => [
'strtolower' => 1,
'spaceCharacter' => '-'
]
]
]
],
'newsTagConfiguration' => [
[
'GETvar' => 'tx_news_pi1[overwriteDemand][tags]',
'lookUpTable' => [
'table' => 'tx_news_domain_model_tag',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => [
'strtolower' => 1,
'spaceCharacter' => '-'
]
]
]
],
'PAGE_UID' => 'newsDetailConfiguration',
//'PAGE_UID' => 'newsCategoryConfiguration',
//'PAGE_UID' => 'newsTagConfiguration'
],
'postVarSets' => [
'_DEFAULT' => [
'controller' => [
[
'GETvar' => 'tx_news_pi1[action]',
'noMatch' => 'bypass'
],
[
'GETvar' => 'tx_news_pi1[controller]',
'noMatch' => 'bypass'
]
],
'dateFilter' => [
[
'GETvar' => 'tx_news_pi1[overwriteDemand][year]',
],
[
'GETvar' => 'tx_news_pi1[overwriteDemand][month]',
],
],
'page' => [
[
'GETvar' => 'tx_news_pi1[@widget_0][currentPage]'
]
]
]
]
];
foreach ($domainConfiguration as $domain => $domainRootPageUid) {
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'][$domain] = $txRealUrlConfiguration;
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'][$domain]['pagePath']['rootpage_id'] = $domainRootPageUid;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment