Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.sao.ru/ztcs/manual/de/mod/mod_dir.html
Дата изменения: Mon Feb 25 15:09:02 2008 Дата индексирования: Sun Apr 10 13:19:57 2016 Кодировка: Поисковые слова: iss |
Apache HTTP Server Version 2.2
Description: | Provides for "trailing slash" redirects and serving directory index files |
---|---|
Status: | Base |
Module Identifier: | dir_module |
Source File: | mod_dir.c |
The index of a directory can come from one of two sources:
index.html
. The DirectoryIndex
directive sets the
name of this file. This is controlled by
mod_dir
.mod_autoindex
.The two functions are separated so that you can completely remove (or replace) automatic index generation should you want to.
A "trailing slash" redirect is issued when the server
receives a request for a URL
http://servername/foo/dirname
where
dirname
is a directory. Directories require a
trailing slash, so mod_dir
issues a redirect to
http://servername/foo/dirname/
.
Description: | List of resources to look for when the client requests a directory |
---|---|
Syntax: | DirectoryIndex
local-url [local-url] ... |
Default: | DirectoryIndex index.html |
Context: | server config, virtual host, directory, .htaccess |
Override: | Indexes |
Status: | Base |
Module: | mod_dir |
The DirectoryIndex
directive sets the
list of resources to look for, when the client requests an index
of the directory by specifying a / at the end of the directory
name. Local-url is the (%-encoded) URL of a document on
the server relative to the requested directory; it is usually the
name of a file in the directory. Several URLs may be given, in
which case the server will return the first one that it finds. If
none of the resources exist and the Indexes
option is
set, the server will generate its own listing of the
directory.
DirectoryIndex index.html
then a request for http://myserver/docs/
would
return http://myserver/docs/index.html
if it
exists, or would list the directory if it did not.
Note that the documents do not need to be relative to the directory;
DirectoryIndex index.html index.txt /cgi-bin/index.pl
would cause the CGI script /cgi-bin/index.pl
to be
executed if neither index.html
or index.txt
existed in a directory.
Description: | Toggle trailing slash redirects on or off |
---|---|
Syntax: | DirectorySlash On|Off |
Default: | DirectorySlash On |
Context: | server config, virtual host, directory, .htaccess |
Override: | Indexes |
Status: | Base |
Module: | mod_dir |
Compatibility: | Available in version 2.0.51 and later |
The DirectorySlash
directive determines, whether
mod_dir
should fixup URLs pointing to a directory or
not.
Typically if a user requests a resource without a trailing slash, which
points to a directory, mod_dir
redirects him to the same
resource, but with trailing slash for some good reasons:
mod_autoindex
works correctly. Since it doesn't emit
the path in the link, it would point to the wrong path.DirectoryIndex
will be evaluated
only for directories requested with trailing slash.Well, if you don't want this effect and the reasons above don't apply to you, you can turn off the redirect with:
# see security warning below!
<Location /some/path>
DirectorySlash Off
SetHandler some-handler
</Location>
Turning off the trailing slash redirect may result in an information
disclosure. Consider a situation where mod_autoindex
is
active (Options +Indexes
) and DirectoryIndex
is set to a valid resource (say,
index.html
) and there's no other special handler defined for
that URL. In this case a request with a trailing slash would show the
index.html
file. But a request without trailing slash
would list the directory contents.