DekGenius.com
[ Team LiB ] Previous Section Next Section

Recipe 9.3 Customized Error Messages

Problem

You want to display a customized error message, rather than the default Apache error page.

Solution

Use the ErrorDocument directive in httpd.conf:

ErrorDocument 405 /errors/notallowed.html

Discussion

The ErrorDocument directive allows you to create your own error pages to be displayed when particular error conditions occur. In the previous example, in the event of a 405 status code (Method Not Allowed), the specified URL is displayed for the user, rather than the default Apache error page.

The page can be customized to look like the rest of your web site. When an error document looks significantly different from the rest of the site, this can leave the user feeling disoriented, or she may feel as if she has left the site that she is currently on.

See Also

    [ Team LiB ] Previous Section Next Section