custom-error.html revision f6376d36c4c6d0a91049081f275202a34e10faf6
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen BGCOLOR="#FFFFFF"
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen TEXT="#000000"
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen LINK="#0000FF"
72cbf33ae81fde08384d30c779ff540752d9256cTimo Sirainen VLINK="#000080"
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen ALINK="#FF0000"
024815ea2ffdda9ea79919f18e865663977f73eaTimo Sirainen<!--#include virtual="header.html" -->
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen <DD>Additional functionality. Allows webmasters to configure the response of
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen Apache to some error or problem.
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen <P>Customizable responses can be defined to be activated in the
e8acc691a14a6d0884c5ca9aa4d8507f1e082040Timo Sirainen event of a server detected error or problem.
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen <P>e.g. if a script crashes and produces a "500 Server Error"
09c3a491f4f6ccebe290c7709bdc0d79a187610bTimo Sirainen response, then this response can be replaced with either some
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen friendlier text or by a redirection to another URL (local or
1b3bb8d39686ed24730cbc31cc9a33dc62c8c6c3Timo Sirainen<DT>Old behavior
1b3bb8d39686ed24730cbc31cc9a33dc62c8c6c3Timo Sirainen <DD>NCSA httpd 1.3 would return some boring old error/problem message
1b3bb8d39686ed24730cbc31cc9a33dc62c8c6c3Timo Sirainen which would often be meaningless to the user, and would provide no
1b3bb8d39686ed24730cbc31cc9a33dc62c8c6c3Timo Sirainen means of logging the symptoms which caused it.<BR>
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen<DT>New behavior
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen <DD>The server can be asked to;
287ba82a8da3eaa473b5735d4eeac2fb4c5d8117Timo Sirainen <LI>Display some other text, instead of the NCSA hard coded messages, or
1175f27441385a7011629f295f42708f9a3a4ffcTimo Sirainen <LI>redirect to a local URL, or
287ba82a8da3eaa473b5735d4eeac2fb4c5d8117Timo Sirainen <LI>redirect to an external URL.
287ba82a8da3eaa473b5735d4eeac2fb4c5d8117Timo Sirainen <P>Redirecting to another URL can be useful, but only if some information
287ba82a8da3eaa473b5735d4eeac2fb4c5d8117Timo Sirainen can be passed which can then be used to explain and/or log the error/problem
287ba82a8da3eaa473b5735d4eeac2fb4c5d8117Timo Sirainen more clearly.
287ba82a8da3eaa473b5735d4eeac2fb4c5d8117Timo Sirainen <P>To achieve this, Apache will define new CGI-like environment
bb10ebcf076c959c752f583746d83805d7686df8Timo SirainenREDIRECT_HTTP_ACCEPT=*/*, image/gif, image/x-xbitmap, image/jpeg <br>
bb10ebcf076c959c752f583746d83805d7686df8Timo SirainenREDIRECT_HTTP_USER_AGENT=Mozilla/1.1b2 (X11; I; HP-UX A.09.05 9000/712) <br>
16c89b1260c9d07c01c83a9219424d3727069b2eTimo SirainenREDIRECT_QUERY_STRING= <br>
287ba82a8da3eaa473b5735d4eeac2fb4c5d8117Timo SirainenREDIRECT_REMOTE_ADDR=121.345.78.123 <br>
bb10ebcf076c959c752f583746d83805d7686df8Timo SirainenREDIRECT_SERVER_PORT=80 <br>
287ba82a8da3eaa473b5735d4eeac2fb4c5d8117Timo Sirainen <P>At least <code>REDIRECT_URL</code> and <code>REDIRECT_QUERY_STRING</code> will
287ba82a8da3eaa473b5735d4eeac2fb4c5d8117Timo Sirainen be passed to the new URL (assuming it's a cgi-script or a cgi-include). The
287ba82a8da3eaa473b5735d4eeac2fb4c5d8117Timo Sirainen other variables will exist only if they existed prior to the error/problem.
287ba82a8da3eaa473b5735d4eeac2fb4c5d8117Timo Sirainen <b>None</b> of these will be set if your ErrorDocument is an
287ba82a8da3eaa473b5735d4eeac2fb4c5d8117Timo Sirainen <i>external</i> redirect (i.e. anything starting with a protocol name
287ba82a8da3eaa473b5735d4eeac2fb4c5d8117Timo Sirainen like <code>http:</code>, even if it refers to the same host as the
287ba82a8da3eaa473b5735d4eeac2fb4c5d8117Timo Sirainen<DT>Configuration
287ba82a8da3eaa473b5735d4eeac2fb4c5d8117Timo Sirainen <DD> Use of "ErrorDocument" is enabled for .htaccess files when the
e8acc691a14a6d0884c5ca9aa4d8507f1e082040Timo Sirainen <A HREF="mod/core.html#allowoverride">"FileInfo" override</A> is allowed.
e8acc691a14a6d0884c5ca9aa4d8507f1e082040Timo Sirainen <P>Here are some examples...
09c3a491f4f6ccebe290c7709bdc0d79a187610bTimo SirainenErrorDocument 500 "Sorry, our script crashed. Oh dear<br>
09c3a491f4f6ccebe290c7709bdc0d79a187610bTimo SirainenErrorDocument 404 /Lame_excuses/not_found.html <br>
09c3a491f4f6ccebe290c7709bdc0d79a187610bTimo SirainenErrorDocument 401 /Subscription/how_to_subscribe.html
09c3a491f4f6ccebe290c7709bdc0d79a187610bTimo Sirainen <P>The syntax is,
09c3a491f4f6ccebe290c7709bdc0d79a187610bTimo Sirainen <P><code><A HREF="mod/core.html#errordocument">ErrorDocument</A></code>
09c3a491f4f6ccebe290c7709bdc0d79a187610bTimo Sirainen<3-digit-code> action
659fe5d24825b160cae512538088020d97a60239Timo Sirainen <P>where the action can be,
659fe5d24825b160cae512538088020d97a60239Timo Sirainen <LI>Text to be displayed. Prefix the text with a quote ("). Whatever
1b84018ce06dba050f1111a2cfa6332595f603fdTimo Sirainen follows the quote is displayed. <em>Note: the (") prefix isn't
5a07b37a9df398b5189c14872a600384208ab74bTimo Sirainen displayed.</em>
659fe5d24825b160cae512538088020d97a60239Timo Sirainen <LI>An external URL to redirect to.
5a07b37a9df398b5189c14872a600384208ab74bTimo Sirainen <LI>A local URL to redirect to.
5a07b37a9df398b5189c14872a600384208ab74bTimo Sirainen <DD>Apache's behavior to redirected URLs has been modified so that additional
9d8d1efcc1274ef4d8413c3687549b297d81da10Timo Sirainen environment variables are available to a script/server-include.<p>
5a07b37a9df398b5189c14872a600384208ab74bTimo Sirainen<DT>Old behavior
5a07b37a9df398b5189c14872a600384208ab74bTimo Sirainen <DD>Standard CGI vars were made available to a script which has been
8e7da21696c9f8a6d5e601243fb6172ec85d47b2Timo Sirainen redirected to. No indication of where the redirection came from was provided.
287ba82a8da3eaa473b5735d4eeac2fb4c5d8117Timo Sirainen<DT>New behavior
1b84018ce06dba050f1111a2cfa6332595f603fdTimo SirainenA new batch of environment variables will be initialized for use by a
287ba82a8da3eaa473b5735d4eeac2fb4c5d8117Timo Sirainenscript which has been redirected to. Each new variable will have the
287ba82a8da3eaa473b5735d4eeac2fb4c5d8117Timo Sirainenprefix <code>REDIRECT_</code>. <code>REDIRECT_</code> environment
1175f27441385a7011629f295f42708f9a3a4ffcTimo Sirainenvariables are created from the CGI environment variables which existed
287ba82a8da3eaa473b5735d4eeac2fb4c5d8117Timo Sirainenprior to the redirect, they are renamed with a <code>REDIRECT_</code>
287ba82a8da3eaa473b5735d4eeac2fb4c5d8117Timo Sirainenprefix, i.e. <code>HTTP_USER_AGENT</code> becomes
5a07b37a9df398b5189c14872a600384208ab74bTimo Sirainen<code>REDIRECT_HTTP_USER_AGENT</code>. In addition to these new
287ba82a8da3eaa473b5735d4eeac2fb4c5d8117Timo Sirainenvariables, Apache will define <code>REDIRECT_URL</code> and
287ba82a8da3eaa473b5735d4eeac2fb4c5d8117Timo Sirainen<code>REDIRECT_STATUS</code> to help the script trace its origin.
287ba82a8da3eaa473b5735d4eeac2fb4c5d8117Timo SirainenBoth the original URL and the URL being redirected to can be logged in
287ba82a8da3eaa473b5735d4eeac2fb4c5d8117Timo Sirainenthe access log.
287ba82a8da3eaa473b5735d4eeac2fb4c5d8117Timo Sirainen<!--#include virtual="footer.html" -->