[thelist] Apache: Fun with error docs + tip

Frank lists at frankmarion.com
Fri Aug 1 21:34:41 CDT 2003


I'm gapping out, and for some reason, the idea of re-doing my error pages 
for my site seems to be fun right now. So I'm customising my 404 pages, as 
well as my 500. Can someone tell me what the most frequently encountered 
errors might be and how to cause them to occur on my own server to test it?

404 and 500 can be relatively frequent.

404, request a page that doesn't exist.
500?
Other?


<tip type="Apache" author="Frank Marion">

Did you know that you can customize your Apache error docs? You can dress 
your "404 Not Found" pages, to suite your site's look, for example. It's 
easy (and fully explained in your httpd.conf doc, a plain text file that 
you can edit with any text editor). Note, you'll need to restart Apache for 
the changes to take effect.

 From the comments in the conf file.

---
Customizable error response (Apache style) these come in three flavors

1) plain text
         ErrorDocument 500 "The server made a boo boo.
         n.b.  the single leading (") 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.

---

I, for example have created the following at the root of my server:

         ErrorDocument 404 /err_docs/err_404.cfm
         ErrorDocument 500 /err_docs/err_500.cfm

It's that easy.

</tip>



--
Frank Marion     lists at frankmarion.com      Keep the signal high.  



More information about the thelist mailing list