Project

General

Profile

Actions

Bug #16167

closed

pageNotFound_handling returns 301 instead of 404 as status code

Added by Dmitry Dulepov over 18 years ago. Updated over 18 years ago.

Status:
Closed
Priority:
Should have
Category:
Communication
Target version:
-
Start date:
2006-05-22
Due date:
% Done:

0%

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

Description

Problem: if $TYPO3_CONF_VARS['FE']['pageNotFound_handling'] is set to
absolute or relative URL, than
$TYPO3_CONF_VARS['FE']['pageNotFound_handling_statheader'] is ignored
and client is redirected to error page using code 302. This is
especially bad for search engines like Google because (1) they may not
remove such pages from their index (2) sitemaps do not work properly.

Solution: use t3lib_div::getURL() to fetch error page internally and
pass it to client with correct header. getURL() is extended to accept
custom HTTP headers that we need to send to 404 page (referrer and user
agent).

Patch was discussed in the "core" list and Martin Kutschker voted for it. So only one "+1" is missing. Patch is attached.

(issue imported from #M3532)


Files

404_v2.txt (7.42 KB) 404_v2.txt Administrator Admin, 2006-05-22 14:48
404_v3a.txt (12.7 KB) 404_v3a.txt Administrator Admin, 2006-07-10 12:11
404_v3c.txt (7.07 KB) 404_v3c.txt Administrator Admin, 2006-07-10 12:19
404_final.txt (7.12 KB) 404_final.txt Administrator Admin, 2006-07-11 23:16

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #20772: pageNotFound_handling returns 301 instead of 404Closed2009-07-20

Actions
Actions #1

Updated by Helmut Hummel over 18 years ago

Since 404_v2.txt did not work for me and I found 404_v3a.txt (as well done by Dmitry Dulepov) on the team-core Mailinglist, which works perfectly, I post this Patch here for convenience.

Actions #2

Updated by Helmut Hummel over 18 years ago

Since 404_v3c.txt did not work, I found, that the function file_get_contents is called wrong! Please check this because it is in SVN (both typo3_4_0 and trunk) the wrong way. This ist how it works for me (diff from trunk):

Index: t3lib/class.t3lib_div.php ===================================================================
--- t3lib/class.t3lib_div.php (revision 1615)
+++ t3lib/class.t3lib_div.php (working copy)
@ -2372,7 +2372,7 @
);

if (function_exists('file_get_contents'))    {
- $content = @file_get_contents($url, $ctx);
+ $content = @file_get_contents($url);
}
elseif (false !== ($fd = @fopen($url, 'rb', false, $ctx))) {
$content = '';
Actions #3

Updated by Helmut Hummel over 18 years ago

Patch above is nonsens but:
404_final.txt is checked in in SVN and is working. I think this one can be closed.

Actions

Also available in: Atom PDF