Project

General

Profile

Actions

Bug #16988

closed

pageNotFound doesn't perform a real 301-redirect

Added by Dirk Diebel almost 18 years ago. Updated about 14 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Communication
Target version:
-
Start date:
2007-02-14
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.0
PHP Version:
4
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

I configured the pageNotFound-handling, that in case of a 404-error , typo3 should send a "301 Moved Permanently" header an redirect to the root page.

$TYPO3_CONF_VARS['FE']['pageNotFound_handling'] = 'http://www.example.org';
$TYPO3_CONF_VARS['FE']['pageNotFound_handling_statheader'] = 'HTTP/1.x 301 Moved Permanently';

But it didn't works. The header is sent correctly but there's no real redirect to my root page. Only the content of the root-page is presented under the wrong url.

To make it work , i extended the pageNotFoundHandler in class.tslib_fe.php

Orig :
if (false === $content) {
// Last chance -- redirect
header('Location: '.t3lib_div::locationHeaderUrl($code));
} else {

Changed:
if ( (false === $content) || (strstr($header,'Moved Permanently')) ) {
// Last chance -- redirect
header('Location: '.t3lib_div::locationHeaderUrl($code));
} else {

now, the method checks if "Moved Permanently" is used in the pageNotFound_handling_statheader . If so, it will perform the real redirect.

(issue imported from #M4988)


Files

class.tslib_fe.php.diff (2.54 KB) class.tslib_fe.php.diff Administrator Admin, 2007-02-14 13:55
bug_4988.diff (525 Bytes) bug_4988.diff Administrator Admin, 2007-02-22 08:06
Actions

Also available in: Atom PDF