Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirects doesn't work on a multi root and multi domain setup #81

Open
Simz opened this issue Feb 5, 2019 · 6 comments
Open

Redirects doesn't work on a multi root and multi domain setup #81

Simz opened this issue Feb 5, 2019 · 6 comments

Comments

@Simz
Copy link

Simz commented Feb 5, 2019

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

@foobar13372
Copy link

Is #68 related?

@witrin
Copy link

witrin commented Apr 11, 2019

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.

@Simz
Copy link
Author

Simz commented Apr 11, 2019

Did you try my fix ?

@djangones
Copy link

@Simz, your fix worked for me! Thanks!

@konnisoelch
Copy link

konnisoelch commented May 19, 2020

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

@Simz
Copy link
Author

Simz commented May 19, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants