[TYPO3-v4] HTTP Status and protected pages
Steffen Kamper
info at sk-typo3.de
Wed Mar 16 20:54:57 CET 2011
Am 16.03.2011 20:30, schrieb Helmut Hummel:
> Hi Steffen,
>
> On 16.03.11 14:15, Steffen Kamper wrote:
>
>> I wrote an extension now, and i can see exactly what the reason for
>> notFound is.
>
> Do you use realurl in this installation? If yes, can you share a little
> code snippet how you check what the reason of the 404 is?
>
> If I remeber right I was not able to distinguish a page not found from a
> page not accessible when realurl was enabled.
>
i use realurl, and here is a very simple q&d check
public function main($params, $TSFE) {
// reset pageNotFound_handling, otherwise an endless loop in
determineId() occurs for one level .html urls
$GLOBALS['TSFE']->TYPO3_CONF_VARS['FE']['pageNotFound_handling'] = NULL;
$config =
unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['pagenotfound']);
$isLoggedIn = $TSFE->fe_user->user ? TRUE : FALSE;
$rootPage = t3lib_div::getIndpEnv('TYPO3_SITE_URL');
if ($params['pageAccessFailureReasons']) {
// no access
if ($isLoggedIn) {
$page = isset($config['notAuthorizedLogIn']) ?
$config['notAuthorizedLogIn'] : $rootPage;
} else {
$page = isset($config['notAuthorizedNoAccess']) ?
$config['notAuthorizedNoAccess'] : $rootPage;
}
$this->redirect(t3lib_utility_Http::HTTP_STATUS_301, $page);
} else {
// page not found
if (isset($config['general404'])) {
$this->redirect(t3lib_utility_Http::HTTP_STATUS_401,
$config['general404']);
} else {
$this->redirect(t3lib_utility_Http::HTTP_STATUS_401, $rootPage);
}
}
}
vg Steffen
More information about the TYPO3-project-v4
mailing list