<-
Apache > Servidor HTTP > Documentación > Versión 2.4 > Módulos

Funcionalidad Básica de Apache

Idiomas disponibles:  de  |  en  |  es  |  fr  |  ja  |  tr 

Esta traducción podría estar obsoleta. Consulte la versión en inglés de la documentación para comprobar si se han producido cambios recientemente.
Descripción:Funcionalides básicas del Servidor HTTP Apache que siempre están presentes.
Estado:Core
Support Apache!

Directivas

Lista de comprobación de errores corregidos

Consulte también

top

Directiva AcceptFilter

Descripción:Configura mejoras para un Protocolo de Escucha de Sockets
Sintaxis:AcceptFilter protocol accept_filter
Contexto:server config
Estado:Core
Módulo:core
Compatibilidad:Disponible en Apache httpd 2.1.5 y posteriores. En Windows desde Apache httpd 2.3.3 y posteriores.

Esta directiva hace posible mejoras específicas a nivel de sistema operativo y a través del tipo de Protocolo para un socket que escucha. La premisa básica es que el kernel no envíe un socket al servidor hasta que o bien los datos se hayan recibido o bien se haya almacenado en el buffer una Respuesta HTTP completa. Actualmente sólo están soportados Accept Filters sobre FreeBSD, TCP_DEFER_ACCEPT sobre Linux, y AcceptEx() sobre Windows.

El uso de none para un argumento desactiva cualquier filtro aceptado para ese protocolo. Esto es útil para protocolos que requieren que un servidor envíe datos primeros, tales como ftp: o nntp:

AcceptFilter nntp none

Los nombres de protocolo por defecto son https para el puerto 443 y http para todos los demás puertos. Para especificar que se está utilizando otro protocolo con un puerto escuchando, añade el argumento protocol a la directiva Listen.

Sobre FreeBDS los valores por defecto:

AcceptFilter http httpready
AcceptFilter https dataready

El filtro httpready almacena en el buffer peticiones HTTP completas a nivel de kernel. Una vez que la petición es recibida, el kernel la envía al servidor. Consulta la página man de accf_http(9) para más detalles. Puesto que las peticiones HTTPS están encriptadas, sólo se utiliza el filtro accf_data(9).

Sobre Linux los valores por defecto son:

AcceptFilter http data
AcceptFilter https data

En Linux, TCP_DEFER_ACCEPT no soporta el buffering en peticiones http. Cualquier valor además de none habilitará TCP_DEFER_ACCEPT en ese socket. Para más detalles ver la página man de Linux tcp(7).

Sobre Windows los valores por defecto son:

AcceptFilter http data
AcceptFilter https data

Sobre Windows mpm_winnt interpreta el argumento AcceptFilter para conmutar la API AcceptEx(), y no soporta el buffering sobre el protocolo http. Hay dos valores que utilizan la API Windows AcceptEx() y que recuperan sockets de red entre conexciones. data espera hasta que los datos han sido transmitidos como se comentaba anteriormente, y el buffer inicial de datos y las direcciones de red son recuperadas a partir de una única llamada AcceptEx(). connect utiliza la API AcceptEx() API, y recupera también las direcciones de red, pero a diferencia de none la opción connect no espera a la transmisión inicial de los datos.

Sobre Windows, none prefiere accept() antes que AcceptEx() y no recuperará sockets entre las conexiones. Lo que es útil para los adaptadores de red con un soporte precario de drivers, así como para algunos proveedores de red tales como drivers vpn, o filtros de spam, de virus o de spyware.

Consulte también

top

Directiva AcceptPathInfo

Descripción:Los recursos aceptan información sobre su ruta
Sintaxis:AcceptPathInfo On|Off|Default
Valor por defecto:AcceptPathInfo Default
Contexto:server config, virtual host, directory, .htaccess
Anula:FileInfo
Estado:Core
Módulo:core
Compatibilidad:Disponible en Apache httpd 2.0.30 y posteriores

Esta directiva controla si las peticiones que contienen información sobre la ruta que sigue un fichero que existe (o un fichero que no existe pero en un directorio que sí existe) serán aceptadas o denegadas. La información de ruta puede estar disponible para los scripts en la variable de entorno PATH_INFO.

Por ejemplo, asumamos que la ubicación /test/ apunta a un directorio que contiene únicamente el fichero here.html. Entonces, las peticiones tanto para /test/here.html/more como para /test/nothere.html/more recogen /more como PATH_INFO.

Los tres posibles argumentos para la directiva AcceptPathInfo son los siguientes:

Off
Una petición sólo será aceptada si se corresponde con una ruta literal que existe. Por lo tanto, una petición con una información de ruta después del nombre de fichero tal como /test/here.html/more en el ejemplo anterior devolverá un error 404 NOT FOUND.
On
Una petición será aceptada si una ruta principal de acceso se corresponde con un fichero que existe. El ejemplo anterior /test/here.html/more será aceptado si /test/here.html corresponde a un fichero válido.
Default
La gestión de las peticiones con información de ruta está determinada por el controlador responsable de la petición. El controlador principal para para ficheros normales rechaza por defecto peticiones PATH_INFO. Los controladores que sirven scripts, tales como cgi-script e isapi-handler, normalmente aceptan PATH_INFO por defecto.

El objetivo principal de la directiva AcceptPathInfo es permitirte sobreescribir la opción del controlador de aceptar or rechazar PATH_INFO. Este tipo de sobreescritura se necesita, por ejemplo, cuando utilizas un filtro, tal como INCLUDES, para generar contenido basado en PATH_INFO. El controlador principal normalmente rechazaría la petición, de modo que puedes utilizar la siguiente configuración para habilitarla como script:

<Files "mypaths.shtml">
Options +Includes
SetOutputFilter INCLUDES
AcceptPathInfo On
</Files>

top

Directiva AccessFileName

Descripción:Nombre del fichero distribuido de configuración
Sintaxis:AccessFileName filename [filename] ...
Valor por defecto:AccessFileName .htaccess
Contexto:server config, virtual host
Estado:Core
Módulo:core

Mientras que procesa una petición el servidor busca el primer fichero de configuración existente dentro de un listado de nombres en cada directorio de la ruta del documento, si los ficheros distribuidos de configuración están habilitados para ese directorio. Por ejemplo:

AccessFileName .acl

antes de servir el documento /usr/local/web/index.html, el servidor leerá /.acl, /usr/.acl, /usr/local/.acl and /usr/local/web/.acl para las directivas, salvo que estén deshabilitadas with

<Directory />
AllowOverride None
</Directory>

Consulte también

top

Directiva AddDefaultCharset

Descripción:Default charset parameter to be added when a response content-type is text/plain or text/html
Sintaxis:AddDefaultCharset On|Off|charset
Valor por defecto:AddDefaultCharset Off
Contexto:server config, virtual host, directory, .htaccess
Anula:FileInfo
Estado:Core
Módulo:core

This directive specifies a default value for the media type charset parameter (the name of a character encoding) to be added to a response if and only if the response's content-type is either text/plain or text/html. This should override any charset specified in the body of the response via a META element, though the exact behavior is often dependent on the user's client configuration. A setting of AddDefaultCharset Off disables this functionality. AddDefaultCharset On enables a default charset of iso-8859-1. Any other value is assumed to be the charset to be used, which should be one of the IANA registered charset values for use in Internet media types (MIME types). For example:

AddDefaultCharset utf-8

AddDefaultCharset should only be used when all of the text resources to which it applies are known to be in that character encoding and it is too inconvenient to label their charset individually. One such example is to add the charset parameter to resources containing generated content, such as legacy CGI scripts, that might be vulnerable to cross-site scripting attacks due to user-provided data being included in the output. Note, however, that a better solution is to just fix (or delete) those scripts, since setting a default charset does not protect users that have enabled the "auto-detect character encoding" feature on their browser.

Consulte también

top

Directiva AllowEncodedSlashes

Descripción:Determines whether encoded path separators in URLs are allowed to be passed through
Sintaxis:AllowEncodedSlashes On|Off
Valor por defecto:AllowEncodedSlashes Off
Contexto:server config, virtual host
Estado:Core
Módulo:core
Compatibilidad:Available in Apache httpd 2.0.46 and later

The AllowEncodedSlashes directive allows URLs which contain encoded path separators (%2F for / and additionally %5C for \ on according systems) to be used. Normally such URLs are refused with a 404 (Not found) error.

Turning AllowEncodedSlashes On is mostly useful when used in conjunction with PATH_INFO.

Note

Allowing encoded slashes does not imply decoding. Occurrences of %2F or %5C (only on according systems) will be left as such in the otherwise decoded URL string.

Consulte también

top

Directiva AllowOverride

Descripción:Types of directives that are allowed in .htaccess files
Sintaxis:AllowOverride All|None|directive-type [directive-type] ...
Valor por defecto:AllowOverride None (2.3.9 and later), AllowOverride All (2.3.8 and earlier)
Contexto:directory
Estado:Core
Módulo:core

When the server finds an .htaccess file (as specified by AccessFileName) it needs to know which directives declared in that file can override earlier configuration directives.

Only available in <Directory> sections

AllowOverride is valid only in <Directory> sections specified without regular expressions, not in <Location>, <DirectoryMatch> or <Files> sections.

When this directive is set to None, then .htaccess files are completely ignored. In this case, the server will not even attempt to read .htaccess files in the filesystem.

When this directive is set to All, then any directive which has the .htaccess Context is allowed in .htaccess files.

The directive-type can be one of the following groupings of directives.

AuthConfig
Allow use of the authorization directives (AuthDBMGroupFile, AuthDBMUserFile, AuthGroupFile, AuthName, AuthType, AuthUserFile, Require, etc.).
FileInfo
Allow use of the directives controlling document types (ErrorDocument, ForceType, LanguagePriority, SetHandler, SetInputFilter, SetOutputFilter, and mod_mime Add* and Remove* directives), document meta data (Header, RequestHeader, SetEnvIf, SetEnvIfNoCase, BrowserMatch, CookieExpires, CookieDomain, CookieStyle, CookieTracking, CookieName), mod_rewrite directives RewriteEngine, RewriteOptions, RewriteBase, RewriteCond, RewriteRule) and Action from mod_actions.
Indexes
Allow use of the directives controlling directory indexing (AddDescription, AddIcon, AddIconByEncoding, AddIconByType, DefaultIcon, DirectoryIndex, FancyIndexing, HeaderName, IndexIgnore, IndexOptions, ReadmeName, etc.).
Limit
Allow use of the directives controlling host access (Allow, Deny and Order).
Options[=Option,...]
Allow use of the directives controlling specific directory features (Options and XBitHack). An equal sign may be given followed by a comma (but no spaces) separated lists of options that may be set using the Options command.

Example:

AllowOverride AuthConfig Indexes

In the example above all directives that are neither in the group AuthConfig nor Indexes cause an internal server error.

For security and performance reasons, do not set AllowOverride to anything other than None in your <Directory /> block. Instead, find (or create) the <Directory> block that refers to the directory where you're actually planning to place a .htaccess file.

Consulte también

top

Directiva AllowOverrideList

Descripción:Individual directives that are allowed in .htaccess files
Sintaxis:AllowOverrideList None|directive [directive-type] ...
Valor por defecto:AllowOverrideList None
Contexto:directory
Estado:Core
Módulo:core

The documentation for this directive has not been translated yet. Please have a look at the English version.

Consulte también

top

Directiva CGIMapExtension

Descripción:Technique for locating the interpreter for CGI scripts
Sintaxis:CGIMapExtension cgi-path .extension
Contexto:directory, .htaccess
Anula:FileInfo
Estado:Core
Módulo:core
Compatibilidad:NetWare only

This directive is used to control how Apache httpd finds the interpreter used to run CGI scripts. For example, setting CGIMapExtension sys:\foo.nlm .foo will cause all CGI script files with a .foo extension to be passed to the FOO interpreter.

top

Directiva CGIPassAuth

Descripción:Enables passing HTTP authorization headers to scripts as CGI variables
Sintaxis:CGIPassAuth On|Off
Valor por defecto:CGIPassAuth Off
Contexto:directory, .htaccess
Anula:AuthConfig
Estado:Core
Módulo:core
Compatibilidad:Available in Apache HTTP Server 2.4.13 and later

The documentation for this directive has not been translated yet. Please have a look at the English version.

top

Directiva CGIVar

Descripción:Controls how some CGI variables are set
Sintaxis:CGIVar variable rule
Contexto:directory, .htaccess
Anula:FileInfo
Estado:Core
Módulo:core
Compatibilidad:Available in Apache HTTP Server 2.4.21 and later

The documentation for this directive has not been translated yet. Please have a look at the English version.

top

Directiva ContentDigest

Descripción:Enables the generation of Content-MD5 HTTP Response headers
Sintaxis:ContentDigest On|Off
Valor por defecto:ContentDigest Off
Contexto:server config, virtual host, directory, .htaccess
Anula:Options
Estado:Core
Módulo:core

This directive enables the generation of Content-MD5 headers as defined in RFC1864 respectively RFC2616.

MD5 is an algorithm for computing a "message digest" (sometimes called "fingerprint") of arbitrary-length data, with a high degree of confidence that any alterations in the data will be reflected in alterations in the message digest.

The Content-MD5 header provides an end-to-end message integrity check (MIC) of the entity-body. A proxy or client may check this header for detecting accidental modification of the entity-body in transit. Example header:

Content-MD5: AuLb7Dp1rqtRtxz2m9kRpA==

Note that this can cause performance problems on your server since the message digest is computed on every request (the values are not cached).

Content-MD5 is only sent for documents served by the core, and not by any module. For example, SSI documents, output from CGI scripts, and byte range responses do not have this header.

top

Directiva DefaultRuntimeDir

Descripción:Base directory for the server run-time files
Sintaxis:DefaultRuntimeDir directory-path
Valor por defecto:DefaultRuntimeDir DEFAULT_REL_RUNTIMEDIR (logs/)
Contexto:server config
Estado:Core
Módulo:core
Compatibilidad:Available in Apache 2.4.2 and later

The documentation for this directive has not been translated yet. Please have a look at the English version.

Consulte también

top

Directiva DefaultType

Descripción:This directive has no effect other than to emit warnings if the value is not none. In prior versions, DefaultType would specify a default media type to assign to response content for which no other media type configuration could be found.
Sintaxis:DefaultType media-type|none
Valor por defecto:DefaultType none
Contexto:server config, virtual host, directory, .htaccess
Anula:FileInfo
Estado:Core
Módulo:core
Compatibilidad:The argument none is available in Apache httpd 2.2.7 and later. All other choices are DISABLED for 2.3.x and later.

This directive has been disabled. For backwards compatibility of configuration files, it may be specified with the value none, meaning no default media type. For example:

DefaultType None

DefaultType None is only available in httpd-2.2.7 and later.

Use the mime.types configuration file and the AddType to configure media type assignments via file extensions, or the ForceType directive to configure the media type for specific resources. Otherwise, the server will send the response without a Content-Type header field and the recipient may attempt to guess the media type.

top

Directiva Define

Descripción:Define the existence of a variable
Sintaxis:Define parameter-name
Contexto:server config
Estado:Core
Módulo:core

Equivalent to passing the -D argument to httpd.

This directive can be used to toggle the use of <IfDefine> sections without needing to alter -D arguments in any startup scripts.

top

Directiva <Directory>

Descripción:Enclose a group of directives that apply only to the named file-system directory, sub-directories, and their contents.
Sintaxis:<Directory directory-path> ... </Directory>
Contexto:server config, virtual host
Estado:Core
Módulo:core

<Directory> and </Directory> are used to enclose a group of directives that will apply only to the named directory, sub-directories of that directory, and the files within the respective directories. Any directive that is allowed in a directory context may be used. Directory-path is either the full path to a directory, or a wild-card string using Unix shell-style matching. In a wild-card string, ? matches any single character, and * matches any sequences of characters. You may also use [] character ranges. None of the wildcards match a `/' character, so <Directory /*/public_html> will not match /home/user/public_html, but <Directory /home/*/public_html> will match. Example:

<Directory /usr/local/httpd/htdocs>
Options Indexes FollowSymLinks
</Directory>

Be careful with the directory-path arguments: They have to literally match the filesystem path which Apache httpd uses to access the files. Directives applied to a particular <Directory> will not apply to files accessed from that same directory via a different path, such as via different symbolic links.

Regular expressions can also be used, with the addition of the ~ character. For example:

<Directory ~ "^/www/.*/[0-9]{3}">

would match directories in /www/ that consisted of three numbers.

If multiple (non-regular expression) <Directory> sections match the directory (or one of its parents) containing a document, then the directives are applied in the order of shortest match first, interspersed with the directives from the .htaccess files. For example, with

<Directory />
AllowOverride None
</Directory>

<Directory /home/>
AllowOverride FileInfo
</Directory>

for access to the document /home/web/dir/doc.html the steps are:

Regular expressions are not considered until after all of the normal sections have been applied. Then all of the regular expressions are tested in the order they appeared in the configuration file. For example, with

<Directory ~ abc$>
# ... directives here ...
</Directory>

the regular expression section won't be considered until after all normal <Directory>s and .htaccess files have been applied. Then the regular expression will match on /home/abc/public_html/abc and the corresponding <Directory> will be applied.

Note that the default access for <Directory /> is Allow from All. This means that Apache httpd will serve any file mapped from an URL. It is recommended that you change this with a block such as

<Directory />
Order Deny,Allow
Deny from All
</Directory>

and then override this for directories you want accessible. See the Security Tips page for more details.

The directory sections occur in the apache2.conf file. <Directory> directives cannot nest, and cannot appear in a <Limit> or <LimitExcept> section.

Consulte también

top

Directiva <DirectoryMatch>

Descripción:Enclose directives that apply to the contents of file-system directories matching a regular expression.
Sintaxis:<DirectoryMatch regex> ... </DirectoryMatch>
Contexto:server config, virtual host
Estado:Core
Módulo:core

<DirectoryMatch> and </DirectoryMatch> are used to enclose a group of directives which will apply only to the named directory (and the files within), the same as <Directory>. However, it takes as an argument a regular expression. For example:

<DirectoryMatch "^/www/(.+/)?[0-9]{3}">

would match directories in /www/ that consisted of three numbers.

Compatability

Prior to 2.3.9, this directive implicitly applied to sub-directories (like <Directory>) and could not match the end of line symbol ($). In 2.3.9 and later, only directories that match the expression are affected by the enclosed directives.

Trailing Slash

This directive applies to requests for directories that may or may not end in a trailing slash, so expressions that are anchored to the end of line ($) must be written with care.

Consulte también

top

Directiva DocumentRoot

Descripción:Directory that forms the main document tree visible from the web
Sintaxis:DocumentRoot directory-path
Valor por defecto:DocumentRoot /usr/local/apache/htdocs
Contexto:server config, virtual host
Estado:Core
Módulo:core

This directive sets the directory from which httpd will serve files. Unless matched by a directive like Alias, the server appends the path from the requested URL to the document root to make the path to the document. Example:

DocumentRoot /usr/web

then an access to http://www.my.host.com/index.html refers to /usr/web/index.html. If the directory-path is not absolute then it is assumed to be relative to the ServerRoot.

The DocumentRoot should be specified without a trailing slash.

Consulte también

top

Directiva <Else>

Descripción:Contains directives that apply only if the condition of a previous <If> or <ElseIf> section is not satisfied by a request at runtime
Sintaxis:<Else> ... </Else>
Contexto:server config, virtual host, directory, .htaccess
Anula:All
Estado:Core
Módulo:core
Compatibilidad:Nested conditions are evaluated in 2.4.26 and later

The documentation for this directive has not been translated yet. Please have a look at the English version.

Consulte también

top

Directiva <ElseIf>

Descripción:Contains directives that apply only if a condition is satisfied by a request at runtime while the condition of a previous <If> or <ElseIf> section is not satisfied
Sintaxis:<ElseIf expression> ... </ElseIf>
Contexto:server config, virtual host, directory, .htaccess
Anula:All
Estado:Core
Módulo:core
Compatibilidad:Nested conditions are evaluated in 2.4.26 and later

The documentation for this directive has not been translated yet. Please have a look at the English version.

Consulte también

top

Directiva EnableMMAP

Descripción:Use memory-mapping to read files during delivery
Sintaxis:EnableMMAP On|Off
Valor por defecto:EnableMMAP On
Contexto:server config, virtual host, directory, .htaccess
Anula:FileInfo
Estado:Core
Módulo:core

This directive controls whether the httpd may use memory-mapping if it needs to read the contents of a file during delivery. By default, when the handling of a request requires access to the data within a file -- for example, when delivering a server-parsed file using mod_include -- Apache httpd memory-maps the file if the OS supports it.

This memory-mapping sometimes yields a performance improvement. But in some environments, it is better to disable the memory-mapping to prevent operational problems:

For server configurations that are vulnerable to these problems, you should disable memory-mapping of delivered files by specifying:

EnableMMAP Off

For NFS mounted files, this feature may be disabled explicitly for the offending files by specifying:

<Directory "/path-to-nfs-files"> EnableMMAP Off </Directory>

top

Directiva EnableSendfile

Descripción:Use the kernel sendfile support to deliver files to the client
Sintaxis:EnableSendfile On|Off
Valor por defecto:EnableSendfile Off
Contexto:server config, virtual host, directory, .htaccess
Anula:FileInfo
Estado:Core
Módulo:core
Compatibilidad:Available in version 2.0.44 and later. Default changed to Off in version 2.3.9.

This directive controls whether httpd may use the sendfile support from the kernel to transmit file contents to the client. By default, when the handling of a request requires no access to the data within a file -- for example, when delivering a static file -- Apache httpd uses sendfile to deliver the file contents without ever reading the file if the OS supports it.

This sendfile mechanism avoids separate read and send operations, and buffer allocations. But on some platforms or within some filesystems, it is better to disable this feature to avoid operational problems:

For server configurations that are not vulnerable to these problems, you may enable this feature by specifying:

EnableSendfile On

For network mounted files, this feature may be disabled explicitly for the offending files by specifying:

<Directory "/path-to-nfs-files"> EnableSendfile Off </Directory>

Please note that the per-directory and .htaccess configuration of EnableSendfile is not supported by mod_cache_disk. Only global definition of EnableSendfile is taken into account by the module.

top

Directiva Error

Descripción:Abort configuration parsing with a custom error message
Sintaxis:Error message
Contexto:server config, virtual host, directory, .htaccess
Estado:Core
Módulo:core
Compatibilidad:2.3.9 and later

If an error can be detected within the configuration, this directive can be used to generate a custom error message, and halt configuration parsing. The typical use is for reporting required modules which are missing from the configuration.

Example

# ensure that mod_include is loaded
<IfModule !include_module>
Error mod_include is required by mod_foo. Load it with LoadModule.
</IfModule>

# ensure that exactly one of SSL,NOSSL is defined
<IfDefine SSL>
<IfDefine NOSSL>
Error Both SSL and NOSSL are defined. Define only one of them.
</IfDefine>
</IfDefine>
<IfDefine !SSL>
<IfDefine !NOSSL>
Error Either SSL or NOSSL must be defined.
</IfDefine>
</IfDefine>

top

Directiva ErrorDocument

Descripción:What the server will return to the client in case of an error
Sintaxis:ErrorDocument error-code document
Contexto:server config, virtual host, directory, .htaccess
Anula:FileInfo
Estado:Core
Módulo:core

In the event of a problem or error, Apache httpd 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 httpd will sometimes offer additional information regarding the problem/error.

URLs can begin with a slash (/) for local web-paths (relative to the DocumentRoot), 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"

Additionally, the special value default can be used to specify Apache httpd's simple hardcoded message. While not required under normal circumstances, default will restore Apache httpd's simple hardcoded message for configurations that would otherwise inherit an existing ErrorDocument.

ErrorDocument 404 /cgi-bin/bad_urls.pl

<Directory /web/docs>
ErrorDocument 404 default
</Directory>

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 HTTP Server 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