[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cobalt-users] [cobalt-users].htaccess custom 404
- Subject: [cobalt-users] [cobalt-users].htaccess custom 404
- From: Marco Baurdoux <linux@xxxxxxxxxxxxx>
- Date: Thu Oct 4 18:02:57 2001
- List-id: Mailing list for users to share thoughts on Cobalt products. <cobalt-users.list.cobalt.com>
Ok now here the result of a research on the .htaccess ErrorDocument
ErrorDocument directive
Syntax: ErrorDocument error-code document
Context: server config, virtual host, directory, .htaccess
Status: core
Override: FileInfo
Compatibility: The directory and .htaccess contexts are only available in
Apache 1.1 and later. The quoting syntax prior to Apache 2.0 was different.
In the event of a problem or error, Apache can be configured to do one of
four things,
1. output a simple hardcoded error message
2. output a customized message
3. redirect to a local URL-path to handle the problem/error
4. redirect to an external URL to handle the problem/error
The first option is the default, while options 2-4 are configured using the
ErrorDocument directive, which is followed by the HTTP response code and a
URL or a message. Apache will sometimes offer additional information
regarding the problem/error.
URLs can begin with a slash (/) for local URLs, or be a full URL which the
client can resolve. Alternatively, a message can be provided to be displayed
by the browser. Examples:
ErrorDocument 500 http://foo.example.com/cgi-bin/tester
ErrorDocument 404 /cgi-bin/bad_urls.pl
ErrorDocument 401 /subscription_info.html
ErrorDocument 403 "Sorry can't allow you access today"
Note that when you specify an ErrorDocument that points to a remote URL (ie.
anything with a method such as "http" in front of it), Apache will send a
redirect to the client to tell it where to find the document, even if the
document ends up being on the same server. This has several implications,
the most important being that the client will not receive the original error
status code, but instead will receive a redirect status code. This in turn
can confuse web robots and other clients which try to determine if a URL is
valid using the status code. In addition, if you use a remote URL in an
ErrorDocument 401, the client will not know to prompt the user for a
password since it will not receive the 401 status code. Therefore, if you
use an "ErrorDocument 401" directive then it must refer to a local document.