Bug #68485
closedCrossdomain mount points as first subpage
0%
Description
There seemes to be something wrong when creating a link page to first subpage while this subpage is a mount point to a cross domain page.
Setup:
- Page 1 domain-foo.de
- Home
- Info
- some more pages
- Page 2 domain-bar.de
- Home
- Details (link to first subpage)
- Info (Mount to Info page from domain-foo.de
- some other pages
- some more pages
The created menu for page domain-bar.de will have domain-foo.de for menu entry Details. This only happens in this setup. Mount points as first level menu entries or mount points as any other page seem to generate the correct link with the correct domain.
If you define the mount point not as first subpage but as selected page you run into an infinite redirection.
Updated by Mathias Schreiber about 9 years ago
- Target version deleted (
next-patchlevel)
Updated by Daniel Siepmann over 8 years ago
We encounter the same issue, but in general.
Our setup is:
- Root | - Global Content (no domain) | | - Pages | | - News | | - Projects | - Website 1 (domain 1) | | - Mount Point to Global Content | - Website 2 (domain 2) | | - Mount Point to Global Content
News and Projects are also normal TYPO3 pages.
If you link to a page with configured MP_mapRootPoints, the domain is also changed.
That will change the context of the website which, in our opinion, is not intended.
We use mount points to mount whole page trees into another site.
We've fixed it at the moment with the following code:
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tstemplate.php']['linkData-PostProc'][$_EXTKEY] = '&WebVision\WvCore\Hooks\UrlGenerationHandling->linkData'; $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['typoLink_PostProc'][$_EXTKEY] = '&WebVision\WvCore\Hooks\UrlGenerationHandling->typoLinkPostProc';
<?php namespace WebVision\WvCore\Hooks; /* * This file is part of the TYPO3 CMS project. * * It is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License, either version 2 * of the License, or any later version. * * For the full copyright and license information, please read the * LICENSE.txt file that was distributed with this source code. * * The TYPO3 project - inspiring people to share! */ use TYPO3\CMS\Core\TypoScript\TemplateService; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; /** * Contains hooks to manipulate generation of frontend urls. * * Will keep current domain for urls containing MP vars. * That are all urls pointing to a page via mount point where we want to keep * context of current website. Therefore we keep the current domain. * * @author Daniel Siepmann <d.siepmann@web-vision.de> */ class UrlGenerationHandling { /** * Domain used in generated link. * * Used for later replacement. * * @var string */ protected $domainInLink = ''; /** * Defined whether domain needs processing. * * @var bool */ protected $processDomain = false; /** * Hook called with all arguments contained in generated url. * * Used to check whether we have to manipulate generated url afterwards. * * @param array $params * @param TemplateService $instance * * @return void */ public function linkData(array &$params, TemplateService $instance) { $this->processDomain = false; // check if mp is set, if not, exit if (strpos($params['LD']['linkVars'], 'MP') === false) { return; } $this->processDomain = true; $this->domainInLink = $params['args']['targetDomain']; } /** * Hook called with generated url. * * Used to exchange domain if necessary. * * @param array $params * @param ContentObjectRenderer $instance * * @return void */ public function typoLinkPostProc(array &$params, ContentObjectRenderer $instance) { if (! $this->processDomain) { return; } $currentDomain = (string) GeneralUtility::getIndpEnv('HTTP_HOST'); // Replace TYPO3 generated domain by current domain for link. $params['finalTag'] = str_replace($this->domainInLink, $currentDomain, $params['finalTag']); $params['finalTagParts'] = str_replace($this->domainInLink, $currentDomain, $params['finalTagParts']['url']); $instance->lastTypoLinkUrl = str_replace($this->domainInLink, $currentDomain, $instance->lastTypoLinkUrl); } }
Updated by Benni Mack almost 5 years ago
- Status changed from New to Needs Feedback
Can you please let me know if this issue still exists in TYPO3 v9 / v10 with site handling and the mount point bugfix applied (https://review.typo3.org/c/Packages/TYPO3.CMS/+/62878)?
Updated by Benni Mack over 4 years ago
- Status changed from Needs Feedback to Closed
I consider this fixed in v10 LTS and the next v9 version already, let me know if you feel differently, so I can re-open the issue