custom-error.html revision 10a0f5c68ddce9fdbf13ab410e49b0e0bb807c23
03831d35f7499c87d51205817c93e9a8d42c4baestevel<!--#include virtual="header.html" -->
03831d35f7499c87d51205817c93e9a8d42c4baestevel<DD>Additional functionality. Allows webmasters to configure the response of
03831d35f7499c87d51205817c93e9a8d42c4baestevelApache to some error or problem.<BR>
03831d35f7499c87d51205817c93e9a8d42c4baestevel<P>Customizable responses can be defined to be activated in the event of a
03831d35f7499c87d51205817c93e9a8d42c4baestevelserver detected error or problem.<BR>
03831d35f7499c87d51205817c93e9a8d42c4baestevele.g. if a script crashes and produces a "500 Server Error" response, then
03831d35f7499c87d51205817c93e9a8d42c4baestevelthis response can be replaced with either some friendlier text or by a
03831d35f7499c87d51205817c93e9a8d42c4baestevelredirection to another URL (local or external).
03831d35f7499c87d51205817c93e9a8d42c4baestevel<DT>Old behavior
03831d35f7499c87d51205817c93e9a8d42c4baestevel<DD>NCSA httpd 1.3 would return some boring old error/problem message which
03831d35f7499c87d51205817c93e9a8d42c4baestevelwould often be meaningless to the user, and would provide no means of logging
03831d35f7499c87d51205817c93e9a8d42c4baestevel<DT>New behavior
03831d35f7499c87d51205817c93e9a8d42c4baestevel<DD>The server can be asked to;
7014882c6a3672fd0e5d60200af8643ae53c5928Richard Lowe<LI>Display some other text, instead of the NCSA hard coded messages, or
03831d35f7499c87d51205817c93e9a8d42c4baestevel<LI>redirect to a local URL, or
03831d35f7499c87d51205817c93e9a8d42c4baestevel<LI>redirect to an external URL.
03831d35f7499c87d51205817c93e9a8d42c4baestevel<P>Redirecting to another URL can be useful, but only if some information
03831d35f7499c87d51205817c93e9a8d42c4baestevelcan be passed which can then be used to explain and/or log the error/problem
03831d35f7499c87d51205817c93e9a8d42c4baestevelmore clearly.<BR>To achieve this, Apache will define new CGI-like environment
03831d35f7499c87d51205817c93e9a8d42c4baestevelREDIRECT_HTTP_ACCEPT=*/*, image/gif, image/x-xbitmap, image/jpeg <br>
03831d35f7499c87d51205817c93e9a8d42c4baestevelREDIRECT_HTTP_USER_AGENT=Mozilla/1.1b2 (X11; I; HP-UX A.09.05 9000/712) <br>
03831d35f7499c87d51205817c93e9a8d42c4baestevelREDIRECT_QUERY_STRING= <br>
03831d35f7499c87d51205817c93e9a8d42c4baestevelREDIRECT_REMOTE_ADDR=121.345.78.123 <br>
03831d35f7499c87d51205817c93e9a8d42c4baestevelREDIRECT_SERVER_PORT=80 <br>
03831d35f7499c87d51205817c93e9a8d42c4baestevelAt least <code>REDIRECT_URL</code> and <code>REDIRECT_QUERY_STRING</code> will
03831d35f7499c87d51205817c93e9a8d42c4baestevelbe passed to the new URL (assuming it's a cgi-script or a cgi-include). The
03831d35f7499c87d51205817c93e9a8d42c4baestevelother variables will exist only if they existed prior to the error/problem.<p>
03831d35f7499c87d51205817c93e9a8d42c4baestevel<DT>Configuration
03831d35f7499c87d51205817c93e9a8d42c4baestevel<P>Here are some examples...
03831d35f7499c87d51205817c93e9a8d42c4baestevelErrorDocument 500 "Sorry, our script crashed because %s. Oh dear<br>
03831d35f7499c87d51205817c93e9a8d42c4baestevelThe syntax is, <p>
03831d35f7499c87d51205817c93e9a8d42c4baestevel<code><A HREF="mod/core.html#errordocument">ErrorDocument</A></code>
03831d35f7499c87d51205817c93e9a8d42c4baestevel<3-digit-code> action <p>
03831d35f7499c87d51205817c93e9a8d42c4baestevelwhere the action can be,
03831d35f7499c87d51205817c93e9a8d42c4baestevel<LI>Text to be displayed.<BR>Prefix the text with a quote ("). Whatever
03831d35f7499c87d51205817c93e9a8d42c4baestevelfollows the quote is displayed. If the error/problem produced any additional
7014882c6a3672fd0e5d60200af8643ae53c5928Richard Loweinformation, it can be specified using <code>%s</code>.
7014882c6a3672fd0e5d60200af8643ae53c5928Richard Lowe<em>Note: the (") prefix isn't displayed.</em>
03831d35f7499c87d51205817c93e9a8d42c4baestevel<LI>An external URL to redirect to.
03831d35f7499c87d51205817c93e9a8d42c4baestevel<LI>A local URL to redirect to.
03831d35f7499c87d51205817c93e9a8d42c4baestevel<P><code>ErrorDocument</code> definitions are sensitive to a
03831d35f7499c87d51205817c93e9a8d42c4baestevel<code>SIGHUP</code>, so you can change any of the definitions or add new ones
03831d35f7499c87d51205817c93e9a8d42c4baestevelprior to sending a <code>SIGHUP</code> (kill -1) signal.
03831d35f7499c87d51205817c93e9a8d42c4baestevel<DD>Apache's behaviour to redirected URLs has been modified so that additional
03831d35f7499c87d51205817c93e9a8d42c4baestevelenvironment variables are available to a script/server-include.<p>
03831d35f7499c87d51205817c93e9a8d42c4baestevel<DT>Old behaviour
03831d35f7499c87d51205817c93e9a8d42c4baestevel<DD>Standard CGI vars were made available to a script which has been
03831d35f7499c87d51205817c93e9a8d42c4baestevelredirected to. No indication of where the redirection came from was provided.
03831d35f7499c87d51205817c93e9a8d42c4baestevel<DT>New behaviour
03831d35f7499c87d51205817c93e9a8d42c4baestevel<DD>A new batch of environment variables will be initialized for use by a
03831d35f7499c87d51205817c93e9a8d42c4baestevelscript which has been redirected to.<BR>
03831d35f7499c87d51205817c93e9a8d42c4baestevelEach new variable will have the prefix <code>REDIRECT_</code>.<BR>
03831d35f7499c87d51205817c93e9a8d42c4baestevelREDIRECT_ environment variables are created from the CGI environment
03831d35f7499c87d51205817c93e9a8d42c4baestevelvariables which existed prior to the redirect, they are renamed with a
03831d35f7499c87d51205817c93e9a8d42c4baestevelREDIRECT_ prefix, i.e. HTTP_USER_AGENT -> REDIRECT_HTTP_USER_AGENT.<BR>
03831d35f7499c87d51205817c93e9a8d42c4baestevelIn addition to these new variables, Apache will define
03831d35f7499c87d51205817c93e9a8d42c4baestevel<code>REDIRECT_URL</code> and <code>REDIRECT_STATUS</code> to help the script
03831d35f7499c87d51205817c93e9a8d42c4baesteveltrace its origin.<BR>
03831d35f7499c87d51205817c93e9a8d42c4baestevelLogging: both the original URL and the URL being redirected to, will
<!--#include virtual="footer.html" -->