next up previous contents index
Next: Mail Server Up: Configuring Apache Previous: Enabling User CGI   Contents   Index

Default Error Pages

When you surf the Web there are web pages that pop up every once in a while that tell you that the page you are trying to see is no longer available. Sometimes that is because the web page has changed, and sometimes it is because the web page is not there and the server has decided to display another page instead. This is an easy thing to setup yourself. Open up the /etc/httpd/conf/httpd.conf configuration file again and search for the place that looks like this:

# Customizable error response (Apache style)
#  these come in three flavors
#
#    1) plain text
#ErrorDocument 500 "The server made a boo boo.
#  n.b.  the (") marks it as text, it does not get output
#
#    2) local redirects
#ErrorDocument 404 /missing.html
#  to redirect to local URL /missing.html
#ErrorDocument 404 /cgi-bin/missing_handler.pl
#  N.B.: You can redirect to a script or a document using server-side-includes.
#
#    3) external redirects
#ErrorDocument 402 http://some.other_server.com/subscription_info.html
#  N.B.: Many of the environment variables associated with the original
#  request will *not* be available to such a script.

Everything here is commented out, but there are four examples of what you can do. Example 1 shows how you could have the server display a plain text page with what ever text you wanted. Example 2 shows two types of redirects. You can either redirect a URL to a local HTML or local CGI program. In Example 3 you have external redirects. This is if the server changed and you wanted to page to automatically redirect to the new server. There are other reasons you could use it to redirect to the outside also. Here are some example error page configurations:

ErrorDocument 403 /error403.html
ErrorDocument 404 /error404.html
ErrorDocument 405 /error405.html
ErrorDocument 500 /error500.html

It is quite possible that you will never get some of these errors, but it is still fun to create the web pages. If you would like a complete list of the errors that can or might happen in the future you can check out the Request For Comments (RFC) document number rfc2616. You can probably find a copy of the document anywhere on the Internet by typing rfc2616 into a search engine, but there was a copy at this address when I wrote this:

http://www.w3.org/Protocols/rfc2616/rfc2616.html


next up previous contents index
Next: Mail Server Up: Configuring Apache Previous: Enabling User CGI   Contents   Index
Joseph Colton 2002-09-24