DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

EXT: 404 Error Page Handling

Author:Kasper Skårhøj
Created:2002-11-01T00:32:00
Changed:2004-11-15T14:16:54
Author:Boris Nicolai
Email:boris.nicolai@andavida.com
Info 3:
Info 4:

EXT: 404 Error Page Handling

Extension Key: error_404_handling

Copyright 2004, Boris Nicolai, <boris.nicolai@andavida.com>

This document is published under the Open Content License

available from http://www.opencontent.org/opl.shtml

The content of this document is related to TYPO3

- a GNU/GPL CMS/Framework available from www.typo3.com

Table of Contents

EXT: 404 Error Page Handling 1

Introduction 1

What does it do? 1

Adminstration 1

Known problems 2

To-Do list 2

Changelog 2

Introduction

What does it do?

Error_404_handlingoffers the possibilty to assign to domain-records custom error-pages if the page inside the database was not found or a file on the server was not found

Adminstration

This section shows you, how the extension exactly works, why the development was necessary and how to setup step by step.

((generated))

Why this extension?

The behaviour so far:

If a FILE (eg. my_new_index.htm) was not found, the user got by default the browsers errorpage displayed.If a Typo3-Page was not found, the behaviour was (in my opinion) strange: A (to me) random page was displayed (if a page was displayed). If the pased id wasn´t a number the page inside the page-tree one level above the current page was called.

It also didn't work to assign to a domainrecord a specific error-page, only an errorpage for ALL domains.

Now the behaviour is quite straight forward: If a page or file was not found the extension looks for an errorpage that is assigned to the current domain and displays it. If no errorpage was found, then you get a clear message. The extension also automaticly sends an email to the administrator that the current URL was not found including the referer (if available).

How does it exactly work?

When a page or a file was not found, the (overwritten) function pageNotFoundHandler () in class.tslib_fe.php extracts the domain of the current URL and searches for a corresponding domain with an errorpage in the table sys_domain.If it was found a redirect to the new URL is done.Therefore you have to assign of course in the page- administration an errorpage to a domainrecord, a feature that offers you this extension.

Remark on File-not-found: A directive in the .htaccess redirects to a new page in the root of your website which is similar to the index.php in the root. It then simply calls again the function pageNotFoundHandler () in class.tslib_fe.php.

Setup

Although you have to adjust some parts manually with modifying some files it should not make any trouble at all.

After installing the extension you find in the extension's folder another folder called “files”.

This folder contains the files 404page_not_found.php and example.htaccess .

First of all copy the file 404page_not_found.php into the root of your domain (same directory that contains the files clear.gif , index.php and showpic.php ).

Then open the file example.htaccess in a texteditor AND the file .htacess that you find again in the root of your website (see above). If there is no file called . htacess then create a empty text-file in the root and rename it to . htacess !

Into the .htaccess in the root paste the following lines out of example.htaccess or from here at the very end of the file:

ErrorDocument 404 /path_to_your_typo_root/404page_not_found.phpErrorDocument 500 /path_to_your_typo_root/404page_not_found.php

Just make sure that the path is set correctly!

Now go to the install-tool of typo3 in your administration, look for the flag [warning_email_addr] and insert here an emailaddress where a message shall be send if a page was not found.

Nearly done!

You just have to open each domainrecord and assign an URL with or without http:// in the field “Redirect to an URL if a page...”. That's it!

img-1

One remark: It doesn't matter in which format the URL of the domainrecord is.If the requested URL http://www.mydomain.com wasn´t found, then the extension will find as domainrecord http://www.mydomain.com as well as www.mydomain.com, as well as http://mydomain.com as well as mydomain.com.

Known problems

  • This extension was so far not tested with linux and the simulateStaticDocuments, but should normally make no problems
  • This extension may not work if you have another extension installed that extends the class.fslib_fe.php like speakinguri or sourceopt (another extension from me). This problem is well known and I'm already working on a work-around.

To-Do list

- so far nothing

Changelog

- 0.1.1 Bug: If the domain without any parameters is requested then the error-page was displayed instead of homepage

- 0.1 Fixed a small bug where the field-description in the backend wasn't displayed

- 0.0.1 inicial development

img-2 EXT: 404 Error Page Handling - 3