Open Simz opened 5 years ago
Is #68 related?
Same problem here. It does not seems to work in a multi-site setup. Using TYPO3 8.7.19 and My Redirects 3.4.1.
Did you try my fix ?
@Simz, your fix worked for me! Thanks!
Hi guys, i wonder why you use the RealUrl Config for that problem.
I would rather use the records in sys_domain since, they are always present in a multidomain system.
/**
* Generate link based on current page information
*
* @param string $link
* @return string
* @todo future; refactor for TYPO3 9.x support
*/
protected function generateLink($link)
{
try {
$queryBuilder = $this->getQueryBuilderForTable('sys_domain');
$statement = $queryBuilder->select('pid')->from('sys_domain')->where($queryBuilder->expr()->eq('domainName', $queryBuilder->createNamedParameter(GeneralUtility::getIndpEnv('HTTP_HOST'))))->execute();
$rootPageId = ConfigurationUtility::getDefaultRootPageId($link);
while ($row = $statement->fetch()) {
$rootPageId = $row['pid'];
}
EidUtility::initializeTypoScriptFrontendController($rootPageId);
list($url, $hash) = explode('#', $link, 2);
// Remove hashbang and append at the end
$_link = $this->getContentObjectRenderer()->typoLink_URL(
['parameter' => $url]
);
$link = $_link . ($hash ? '#' . $hash : '');
} catch (\Exception $e) {
}
return $link;
}
We want to use a multiple localized domains with different pids like website.en website.fr subsite1.fr subsite2.ru
On Tue., May 19, 2020, 3:40 a.m. Konstantin Sölch, notifications@github.com wrote:
Hi guys, i wonder why you use the RealUrl Config for that problem.
I would rather use the records in sys_domain since, they are always present in a multidomain system.
/**
- Generate link based on current page information
- @param string $link
- @return string
@todo future; refactor for TYPO3 9.x support */ protected function generateLink($link) { try { $queryBuilder = $this->getQueryBuilderForTable('sys_domain'); $statement = $queryBuilder->select('pid')->from('sys_domain')->where($queryBuilder->expr()->eq('domainName', $queryBuilder->createNamedParameter(GeneralUtility::getIndpEnv('HTTP_HOST'))))->execute();
$defaultRootPageId = ConfigurationUtility::getDefaultRootPageId($link); while ($row = $statement->fetch()) { $defaultRootPageId = $row['pid']; } EidUtility::initializeTypoScriptFrontendController($defaultRootPageId); list($url, $hash) = explode('#', $link, 2); // Remove hashbang and append at the end $_link = $this->getContentObjectRenderer()->typoLink_URL( ['parameter' => $url] ); $link = $_link . ($hash ? '#' . $hash : ''); } catch (\Exception $e) { } return $link;
}
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/koninklijke-collective/my_redirects/issues/81#issuecomment-630644466, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADPRCZC6G6ESO75SECULQDRSIZWLANCNFSM4GUPAB6Q .
The problem is in the function getDefaultRootPageId(). This function only returns the _DEFAULT or the $configuration['defaultRootPageId'] but in a multi root multi domain context, it should return $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'][GeneralUtility::getIndpEnv('HTTP_HOST')]. At least check if the array key exists.
ConfigurationUtility.php.txt