custom-error.html revision 57d0156f7bbd9ea3a72342cf9912aba61d118702
e07d9cb85217949d497b02d7211de8a197d2f2ebzf<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
fb91fd8a302dfb13e250bbefb6a3970c2edc3ae3zf "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
e07d9cb85217949d497b02d7211de8a197d2f2ebzf <meta name="generator" content="HTML Tidy, see www.w3.org" />
e07d9cb85217949d497b02d7211de8a197d2f2ebzf <!-- Background white, links blue (unvisited), navy (visited), red (active) -->
e07d9cb85217949d497b02d7211de8a197d2f2ebzf <!--#include virtual="header.html" -->
e07d9cb85217949d497b02d7211de8a197d2f2ebzf Additional functionality. Allows webmasters to configure
e07d9cb85217949d497b02d7211de8a197d2f2ebzf the response of Apache to some error or problem.
e07d9cb85217949d497b02d7211de8a197d2f2ebzf <p>Customizable responses can be defined to be activated in
e07d9cb85217949d497b02d7211de8a197d2f2ebzf the event of a server detected error or problem.</p>
e07d9cb85217949d497b02d7211de8a197d2f2ebzf Error" response, then this response can be replaced with
e07d9cb85217949d497b02d7211de8a197d2f2ebzf either some friendlier text or by a redirection to another
e07d9cb85217949d497b02d7211de8a197d2f2ebzf URL (local or external).</p>
e07d9cb85217949d497b02d7211de8a197d2f2ebzf <dd>NCSA httpd 1.3 would return some boring old error/problem
e07d9cb85217949d497b02d7211de8a197d2f2ebzf message which would often be meaningless to the user, and
e07d9cb85217949d497b02d7211de8a197d2f2ebzf would provide no means of logging the symptoms which caused
e07d9cb85217949d497b02d7211de8a197d2f2ebzf The server can be asked to;
e07d9cb85217949d497b02d7211de8a197d2f2ebzf <li>Display some other text, instead of the NCSA hard
e07d9cb85217949d497b02d7211de8a197d2f2ebzf coded messages, or</li>
e07d9cb85217949d497b02d7211de8a197d2f2ebzf <p>Redirecting to another URL can be useful, but only if
e07d9cb85217949d497b02d7211de8a197d2f2ebzf some information can be passed which can then be used to
e07d9cb85217949d497b02d7211de8a197d2f2ebzf <p>To achieve this, Apache will define new CGI-like
e07d9cb85217949d497b02d7211de8a197d2f2ebzf <blockquote>
e07d9cb85217949d497b02d7211de8a197d2f2ebzf REDIRECT_QUERY_STRING=<br />
e07d9cb85217949d497b02d7211de8a197d2f2ebzf REDIRECT_REMOTE_ADDR=121.345.78.123<br />
e07d9cb85217949d497b02d7211de8a197d2f2ebzf REDIRECT_SERVER_PORT=80<br />
e07d9cb85217949d497b02d7211de8a197d2f2ebzf </blockquote>
e07d9cb85217949d497b02d7211de8a197d2f2ebzf new URL (assuming it's a cgi-script or a cgi-include). The
e07d9cb85217949d497b02d7211de8a197d2f2ebzf other variables will exist only if they existed prior to
e07d9cb85217949d497b02d7211de8a197d2f2ebzf the error/problem. <strong>None</strong> of these will be
e07d9cb85217949d497b02d7211de8a197d2f2ebzf set if your ErrorDocument is an <em>external</em> redirect
e07d9cb85217949d497b02d7211de8a197d2f2ebzf (<em>i.e.</em>, anything starting with a scheme name like
e07d9cb85217949d497b02d7211de8a197d2f2ebzf <code>http:</code>, even if it refers to the same host as
e07d9cb85217949d497b02d7211de8a197d2f2ebzf the server).</p>
e07d9cb85217949d497b02d7211de8a197d2f2ebzf Use of "ErrorDocument" is enabled for .htaccess files when
e07d9cb85217949d497b02d7211de8a197d2f2ebzf override</a> is allowed.
e07d9cb85217949d497b02d7211de8a197d2f2ebzf <blockquote>
e07d9cb85217949d497b02d7211de8a197d2f2ebzf ErrorDocument 500 "Sorry, our script crashed. Oh
e07d9cb85217949d497b02d7211de8a197d2f2ebzf dear<br />
e07d9cb85217949d497b02d7211de8a197d2f2ebzf ErrorDocument 401
e07d9cb85217949d497b02d7211de8a197d2f2ebzf </blockquote>
e07d9cb85217949d497b02d7211de8a197d2f2ebzf href="mod/core.html#errordocument">ErrorDocument</a></code>
e07d9cb85217949d497b02d7211de8a197d2f2ebzf <3-digit-code> action</p>
e07d9cb85217949d497b02d7211de8a197d2f2ebzf <li>Text to be displayed. Prefix the text with a quote
e07d9cb85217949d497b02d7211de8a197d2f2ebzf ("). Whatever follows the quote is displayed. <em>Note:
e07d9cb85217949d497b02d7211de8a197d2f2ebzf <dd>Apache's behavior to redirected URLs has been modified so
e07d9cb85217949d497b02d7211de8a197d2f2ebzf that additional environment variables are available to a
e07d9cb85217949d497b02d7211de8a197d2f2ebzf <dd>Standard CGI vars were made available to a script which
e07d9cb85217949d497b02d7211de8a197d2f2ebzf has been redirected to. No indication of where the
e07d9cb85217949d497b02d7211de8a197d2f2ebzf redirection came from was provided.</dd>
e07d9cb85217949d497b02d7211de8a197d2f2ebzf <dd>A new batch of environment variables will be initialized
e07d9cb85217949d497b02d7211de8a197d2f2ebzf for use by a script which has been redirected to. Each new
e07d9cb85217949d497b02d7211de8a197d2f2ebzf <code>REDIRECT_</code> environment variables are created from
e07d9cb85217949d497b02d7211de8a197d2f2ebzf the CGI environment variables which existed prior to the
e07d9cb85217949d497b02d7211de8a197d2f2ebzf prefix, <em>i.e.</em>, <code>HTTP_USER_AGENT</code> becomes
e07d9cb85217949d497b02d7211de8a197d2f2ebzf <code>REDIRECT_HTTP_USER_AGENT</code>. In addition to these
e07d9cb85217949d497b02d7211de8a197d2f2ebzf new variables, Apache will define <code>REDIRECT_URL</code>
e07d9cb85217949d497b02d7211de8a197d2f2ebzf and <code>REDIRECT_STATUS</code> to help the script trace its
e07d9cb85217949d497b02d7211de8a197d2f2ebzf origin. Both the original URL and the URL being redirected to
e07d9cb85217949d497b02d7211de8a197d2f2ebzf can be logged in the access log.</dd>
e07d9cb85217949d497b02d7211de8a197d2f2ebzf <p>If the ErrorDocument specifies a local redirect to a CGI
e07d9cb85217949d497b02d7211de8a197d2f2ebzf script, the script should include a "<samp>Status:</samp>"
e07d9cb85217949d497b02d7211de8a197d2f2ebzf header field in its output in order to ensure the propagation
e07d9cb85217949d497b02d7211de8a197d2f2ebzf all the way back to the client of the error condition that
e07d9cb85217949d497b02d7211de8a197d2f2ebzf caused it to be invoked. For instance, a Perl ErrorDocument
e07d9cb85217949d497b02d7211de8a197d2f2ebzf script might include the following:</p>
e07d9cb85217949d497b02d7211de8a197d2f2ebzf printf "Status: %s Condition Intercepted\n", $ENV{"REDIRECT_STATUS"};
e07d9cb85217949d497b02d7211de8a197d2f2ebzf <p>If the script is dedicated to handling a particular error
e07d9cb85217949d497b02d7211de8a197d2f2ebzf condition, such as <samp>404 Not Found</samp>, it can
e07d9cb85217949d497b02d7211de8a197d2f2ebzf use the specific code and error text instead.</p>
e07d9cb85217949d497b02d7211de8a197d2f2ebzf <!--#include virtual="footer.html" -->