[TYPO3] 404 error page redirection

Ries van Twisk typo3 at rvt.dds.nl
Fri May 12 13:46:26 CEST 2006


Klaus Hinum wrote:

>hi group,
>
>i know that this topic has been discussed before and i read that it 
>should be fixed with 4.0 but i still have the problem, that i can't get 
>typo3 to redirect 404 errors to a specific page AND return a 404. i can 
>do either the one (standard error with 404) or redirect (returns 200 and 
>before the number for the redirect).
>  
>
Klaus, for generating 404 page handeling I created this little tutorial:
http://www.rvantwisk.nl/typo3-snippets/page-404-and-301-handling.html

Try it out like this : http://www.rvantwisk.nl/klaus.html

The *pagenotfound.php* file shown there is used on a other domain, not 
on my but here is the one I use.

<?php

define('REDIRECTPAGE', '/404.html');

class user_pagenotfound {

    function pagenotfound($param, $conf) {
        $server_name = $_SERVER['SERVER_NAME'];
        header("HTTP/1.0 404 Not Found");
    print '<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Page not Found!</title>
<SCRIPT LANGUAGE="JavaScript">
<!--
function doRedirect() {
    window.location="http://'.$server_name.REDIRECTPAGE.'";
}

doRedirect();
// -->
</script>

</head>
<body style="font-family: Verdana, Geneva, Arial, Helvetica, 
sans-serif;text-align:center;";>
<div style="font-size:20px;text-align:center">The page you have 
requested cannot be found</div>
<div>If you are not automaticly redirected in 3 seconds please click 
here: <br />
<br /><a href='.$server_name.'>'.$server_name.'</a></div>
</body>
</html>';
exit;
}
}

?>


Appart from this change you can follow the one on my site.

Ries

>do i have to use the extension?
>
>fyi, i use simulated static documents.
>
>thanks in advance
>klaus
>_______________________________________________
>TYPO3-english mailing list
>TYPO3-english at lists.netfielders.de
>http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english
>  
>


-- 
Ries van Twisk
Freelance Typo3 Developer
=== Private:
email: ries at vantwisk.nl
web:   http://www.rvantwisk.nl/freelance-typo3.html
skype: callto://r.vantwisk
=== Work:
email: ries at livetravelguides.com
web:   http://www.livetravelguides.com




More information about the TYPO3-english mailing list