[TYPO3-dev] Multilanguage pageNotFound_handling

Andreas Wagner andreas.wagner at klee.se
Wed Feb 21 19:03:14 CET 2007


John Angel wrote:
> Hi,
> 
> As Andreas said in: http://bugs.typo3.org/view.php?id=4836
> 
> It would be really useful to be able to show a localized 404 page. As it
> is now, you can only show the website user one page no matter what language
> he or she is viewing the website in.
> 
> Michael mentioned simple solution using a little PHP condition in
> localconf.php before setting
> $TYPO3_CONF_VARS['FE']['pageNotFound_handling'].
> 
> Michael, how does look like that PHP condition?
> 
> Another issue is realurl. Incoming URL is probably Speaking URL, not having
> plain L variable.

Hi John,

I solved it like this for realurl:

if (substr($_SERVER['REQUEST_URI'], 0, 4) == '/en/') {
     $TYPO3_CONF_VARS['FE']['pageNotFound_handling'] = '/en/404/';
} else {
     $TYPO3_CONF_VARS['FE']['pageNotFound_handling'] = '/404/';
}

Maybe not the cleanest solution, but it works.

If you need support for non realurl links you should be able to use:

if (substr($_SERVER['REQUEST_URI'], 0, 4) == '/en/' || $_GET['L'] == 1)  {
...

or something similar.

Regards,
Andreas




More information about the TYPO3-dev mailing list