Issue Bug Closed

#103395Redirects with domains without site configuration not possible anymore

Georg Ringer 03/14/24, 08:31 updated 07/09/24, 15:37

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);

Reviews 6