Issue Feature Closed

#65998TypeNum redirect on shortcut page

Arek van Schaijk 03/24/15, 22:56 updated 01/22/18, 09:40

Description

Hi,

My pagetree looks like:

Website name [1] [shortcut:2]
- Home [2]
- …

When registrering a new page type by TypoScript:

xml_sitemap = PAGE
xml_sitemap {
    typeNum = 123
    10 = USER_INT
    10 {
        userFunc = TYPO3\MyExtension\Controller\SitemapController
    }
    config {
        disableAllHeaderCode = 1
        additionalHeaders = Content-type:text/xml
        xhtml_cleaning = 0
        // additional configuration
    }
}

http://domain.com/?type=123 is redirected to http://domain.com/?id=2&type=123.

I’ve configured my typeNum as a filename in the realurl configuration.
So ‘sitemap.xml’ will be ?type=123

Because ‘Website name [1]’ is an shortcut to ‘Home [2]’ domain.com/sitemap.xml is redirected to domain.com/home/sitemap.xml which is obvious pretty ugly :(

After spending some time in the core I figured out that the ‘redirect’ happens in typo3/sysext/cms/tslib/index_ts.php on line 190.
[[https://forge.typo3.org/projects/typo3cms-core/repository/entry/typo3/sysext/cms/tslib/index_ts.php?rev=TYPO3_6-2#L190]]

When I remove this function here I get my sitemap.xml working under domain.com/sitemap.xml.

I suggest a new page.config like:

xml_sitemap = PAGE
xml_sitemap {
    typeNum = 123
    10 = USER_INT
    10 {
        userFunc = TYPO3\MyExtension\Controller\SitemapController
    }
    config {
        // ...
        *ignorePageRedirect = 1*
    }
}

The TypoScriptFrontendController has already access to this configuration. So checkPageForShortcutRedirect() should be extended with a check like:

Ref: [[https://forge.typo3.org/projects/typo3cms-core/repository/entry/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php?rev=TYPO3_6-2#L3195]]

    public function checkPageForShortcutRedirect() {
        if(!$this->$this->pageRenderer->getIgnorePageRedirect()) {
            if (!empty($this->originalShortcutPage) && $this->originalShortcutPage['doktype'] == PageRepository::DOKTYPE_SHORTCUT) {
                $this->redirectToCurrentPage();
            }
        }
    }

This is backward compatible and does not affect anything.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.