[Typo3] Solution: RealURL and 404 error pages

Jens Bierkandt j.bierkandt at nospam.tectrend.de
Fri Sep 2 10:10:11 CEST 2005


Hi Christian,

> how does the rest of your ext_localconf.php look like? 
> unfortunatelly your solution doesn't work with my configuration... 
> maybe the postVarSets part might be very interesting.
> 
> thanks for your help!

here is my current configuration for the RealURL Extension and a short
explanation how I realized it.

Description from Typo3:
'pageNotFound_handling' => '',			// How TYPO3 should handle requests for
non-existing/accessible pages. false (default): The 'nearest' page is
shown. TRUE or '1': An TYPO3 error box is displayed. Integer > 1: Not
used yet. Strings: redirect URL, eg. 'notfound.html' or
'http://www.domain.org/errors/notfound.html'.

'pageNotFound_handling_statheader' => 'Status: 404 Not Found',			// If
'pageNotFound_handling' is enabled, this string will always be sent as
header before the actual handling.
		
Maybe it helps if you only modify the 404 header from
$TYPO3_CONF_VARS["FE"]['pageNotFound_handling_statheader'] = 'HTTP/1.0
404 Not
Found';
to either
a) $TYPO3_CONF_VARS["FE"]['pageNotFound_handling_statheader'] = 'Status:
404 Not Found';
or b) $TYPO3_CONF_VARS["FE"]['pageNotFound_handling_statheader'] =
'HTTP/1.1 404 Not Found';

Detailed description how I did it:
Step 1:
Add the following lines to the Typo3Script Setup code (found at the
menu->Templates). Maybe you need to insert the lines without the preceding
page. depending on your configuration:

# activate RealURL
page.config.simulateStaticDocuments = 0
# Change the following line as needed
page.config.baseURL = http://www.tectrend.de
page.config.tx_realurl_enable = 1
page.config.prefixLocalAnchors = all

Step 2:
Overwrite the ext_localconf.php of the ReadlURL plugin (found at
typo3conf/ext/realurl/) from the bottom.

Step 3:
Turn on the .htaccess in the base/main directory of your installation
and follow the instructions.

Step 4:
Double check if the redirection module of your apache webserver works and
also .htaccess files are allowed and parsed.

I hope I didn't forget anything. Good luck.

Regards,
Jens

ext_localconf.php:
<?php
$TYPO3_CONF_VARS["FE"]['pageNotFound_handling_statheader'] = 'HTTP/1.0
404 Not Found';
$TYPO3_CONF_VARS['SC_OPTIONS'] ['t3lib/class.t3lib_tstemplate.php']
['linkData-PostProc'] []
= 'EXT:realurl/class.tx_realurl.php:&tx_realurl->encodeSpURL';
$TYPO3_CONF_VARS['SC_OPTIONS'] ['tslib/class.tslib_fe.php']
['checkAlternativeIdMethods-PostProc'] []
= 'EXT:realurl/class.tx_realurl.php:&tx_realurl->decodeSpURL';
$TYPO3_CONF_VARS['SC_OPTIONS'] ['t3lib/class.t3lib_tcemain.php']
['clearAllCache_additionalTables'] ['tx_realurl_urldecodecache']
= 'tx_realurl_urldecodecache';
$TYPO3_CONF_VARS['SC_OPTIONS'] ['t3lib/class.t3lib_tcemain.php']
['clearAllCache_additionalTables'] ['tx_realurl_urlencodecache']
= 'tx_realurl_urlencodecache';
$TYPO3_CONF_VARS['FE'] ['addRootLineFields'] .=
',tx_realurl_pathsegment,alias,nav_title,title';
$TYPO3_CONF_VARS['EXTCONF']['realurl'] = array(
'_DEFAULT' => array(
'init' => array(
'enableCHashCache' => 1,
'appendMissingSlash' => 'ifNotFile',
'enableUrlDecodeCache' => 1,
'enableUrlEncodeCache' => 1,
//'postVarSet_failureMode' => 'redirect_goodUpperDir'
),
'redirects' => array(),
'preVars' => array(
array(
'GETvar' => 'no_cache',
'valueMap' => array(
'nc' => 1,
),
'noMatch' => 'bypass',
),
array(
'GETvar' => 'L',
'valueMap' => array(
'dk' => '2',
'de' => '1',
),
'noMatch' => 'bypass',
),
),
'pagePath' => array(
'type' => 'user',
'userFunc' =>
'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'spaceCharacter' => '-',
'languageGetVar' => 'L',
'expireDays' => 7,
),
'fileName' => array (
'defaultToHTMLsuffixOnPrev' => 1,
'index' => array(
'page.html' => array(
'keyValues' => array (
'type' => 1,
),
),
),
),
'fixedPostVars' => array(),
'postVarSets' => array(
'_DEFAULT' => array(
// news archive parameters
'archive' => array(
array(
'GETvar' => 'tx_ttnews[year]' ,
),
array(
'GETvar' => 'tx_ttnews[month]' ,
'valueMap' => array(
'january' => '01',
'february' => '02',
'march' => '03',
'april' => '04',
'may' => '05',
'june' => '06',
'july' => '07',
'august' => '08',
'september' => '09',
'october' => '10',
'november' => '11',
'december' => '12',
)
),
),
// news pagebrowser
'browse' => array(
array(
'GETvar' => 'tx_ttnews[pointer]',
),
),
// news categories
'select_category' => array (
array(
'GETvar' => 'tx_ttnews[cat]',
),
),
// news articles and searchwords
'article' => array(
array(
'GETvar' => 'tx_ttnews[tt_news]',
'lookUpTable' => array(
'table' => 'tt_news',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-',
),
),
),
array(
'GETvar' => 'tx_ttnews[swords]',
),
),
),
),
),
);
?>

-- 
Jens Bierkandt
http://www.tectrend.com



More information about the TYPO3-english mailing list