[TYPO3-core] Reminder: : pageNotFound_handling HTTP status fix

Martin Kutschker Martin.Kutschker at n0spam-blackbox.net
Fri May 12 11:09:42 CEST 2006


Dmitry Dulepov schrieb:
> Hi!
> 
> This is a reminder about CVS patch request
> 
> Branch: HEAD, TYPO3_4-0
> 
> 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 earlier in this list, I need one more +1 for it.

One more change. With CURLOPT_NOBODY we can do a header-only with CURL.

So remove this hint "2=fetch header only (will be ignored when using CURL)"

And add after
  curl_setopt($ch, CURLOPT_HEADER, $includeHeader ? 1 : 0);
this
  curl_setopt($ch, CURLOPT_NOBODY, $includeHeader==2 ? 1 : 0);

Masi

PS: Tested with this script:

<?php

$ch = curl_init();

// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://www.activesolution.at/");
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);

// grab URL
echo curl_exec($ch);

// close CURL resource, and free up system resources
curl_close($ch);

?>



More information about the TYPO3-team-core mailing list