Actions
Bug #103395
closedRedirects with domains without site configuration not possible anymore
Status:
Closed
Priority:
Should have
Assignee:
Category:
Link Handling & Redirect Handling
Target version:
-
Start date:
2024-03-14
Due date:
% Done:
100%
Estimated time:
TYPO3 Version:
12
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:
Description
I upgraded a larger site from 10 to 12 LTS and some redirects don't work anymore.
Setup:
- Main Domain: customer.tld
- Domain other-domain.tld points to the same directory as main domain
- Redirect other-domain.tld/foo to a valid page customer/tld.
The error No TypoScript record found
is thrown triggered from
\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::getFromCache \TYPO3\CMS\Redirects\Service\RedirectService::bootFrontendController
which is valid as there is no site for other-domain
and I also don't want to provide one
my working solution/patch is
--- a/Classes/Service/RedirectService.php +++ b/Classes/Service/RedirectService.php @@ -395,6 +395,9 @@ new PageArguments($site->getRootPageId(), '0', []), $originalRequest->getAttribute('frontend.user') ); + if ($originalRequest->getAttribute('site') instanceof NullSite) { + $originalRequest = $originalRequest->withAttribute('site', GeneralUtility::makeInstance(SiteFinder::class)->getSiteByRootPageId(1)); + } $controller->determineId($originalRequest); $controller->calculateLinkVars($queryParams); $newRequest = $controller->getFromCache($originalRequest);
Actions