📄 mod_autoindex.html
字号:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta name="keywords" content="Apache, 中文, 手册, 中文版, 中文手册, 中文版手册, 参考手册, 中文参考手册, 金步国" />
<meta name="description" content="Apache 2.2 中文版参考手册" />
<meta name="author" content="金步国" />
<link href="../style/css/manual-zip.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
<link href="../style/css/manual-zip-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
<link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
<title>mod_autoindex - Apache 2.2 中文版参考手册</title>
</head>
<body><div id="page-header">
<p class="menu"><a href="../mod/index.html">模块索引</a> | <a href="../mod/directives.html">指令索引</a> | <a href="../faq/index.html">常见问题</a> | <a href="../glossary.html">词汇表</a> | <a href="../sitemap.html">站点导航</a></p><p class="apache">Apache HTTP Server 版本2.2</p><img alt="" src="../images/feather.gif" /></div>
<div class="up"><a href="./index.html"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
<div id="path"><a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">文档</a> > <a href="../index.html">版本2.2</a> > <a href="./index.html">模块</a></div>
<div id="translation-info"> <a href="../translator_announcement.html#thanks">致谢</a> | <a href="../translator_announcement.html#announcement">译者声明</a> | 本篇译者:<<a href="../translator_announcement.html#join">虚位以待</a>> | 本篇译稿完成时间:?年?月?日 | <a href="../translator_announcement.html#last_new">获取最新版本</a></div>
<div id="page-content"><div id="preamble"><h1>Apache模块 mod_autoindex</h1>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="module">
<tr><th><a href="module-dict.html#Description">说明</a></th><td>自动对目录中的内容生成列表,类似于"ls"或"dir"命令</td></tr>
<tr><th><a href="module-dict.html#Status">状态</a></th><td>基本(B)</td></tr>
<tr><th><a href="module-dict.html#ModuleIdentifier">模块名</a></th><td>autoindex_module</td></tr>
<tr><th><a href="module-dict.html#SourceFile">源文件</a></th><td>mod_autoindex.c</td></tr>
</table>
<h3>概述</h3>
<p>The index of a directory can come from one of two
sources:</p>
<ul>
<li>A file written by the user, typically called
<code>index.html</code>. The <code class="directive"><a href="../mod/mod_dir.html#directoryindex">DirectoryIndex</a></code> directive sets the
name of this file. This is controlled by
<code class="module"><a href="../mod/mod_dir.html">mod_dir</a></code>.</li>
<li>Otherwise, a listing generated by the server. The other
directives control the format of this listing. The <code class="directive"><a href="#addicon">AddIcon</a></code>, <code class="directive"><a href="#addiconbyencoding">AddIconByEncoding</a></code>和<code class="directive"><a href="#addiconbytype">AddIconByType</a></code> are
used to set a list of icons to display for various file types;
for each file listed, the first icon listed that matches the
file is displayed. These are controlled by
<code class="module"><a href="../mod/mod_autoindex.html">mod_autoindex</a></code>.</li>
</ul>
<p>The two functions are separated so that you can completely
remove (or replace) automatic index generation should you want
to.</p>
<p>Automatic index generation is enabled with using
<code>Options +Indexes</code>. See the
<code class="directive"><a href="../mod/core.html#options">Options</a></code> directive for
more details.</p>
<p>If the <code><a href="#indexoptions.fancyindexing">FancyIndexing</a></code> option is given with the <code class="directive"><a href="#indexoptions">IndexOptions</a></code> directive,
the column headers are links that control the order of the
display. If you select a header link, the listing will be
regenerated, sorted by the values in that column. Selecting the
same header repeatedly toggles between ascending and descending
order. These column header links are suppressed with
<code class="directive"><a href="#indexoptions">IndexOptions</a></code> directive's
<code>SuppressColumnSorting</code> option.</p>
<p>Note that when the display is sorted by "Size", it's the
<em>actual</em> size of the files that's used, not the
displayed value - so a 1010-byte file will always be displayed
before a 1011-byte file (if in ascending order) even though
they both are shown as "1K".</p>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="query" id="query">Autoindex Request Query Arguments</a></h2>
<p>Apache 2.0.23 reorganized the Query Arguments for Column
Sorting, and introduced an entire group of new query options.
To effectively eliminate all client control over the output,
the <code><a href="#indexoptions.ignoreclient">IndexOptions
IgnoreClient</a></code> option was introduced.</p>
<p>The column sorting headers themselves are self-referencing
hyperlinks that add the sort query options shown below. Any
option below may be added to any request for the directory
resource.</p>
<ul>
<li><code>C=N</code> sorts the directory by file name</li>
<li><code>C=M</code> sorts the directory by last-modified
date, then file name</li>
<li><code>C=S</code> sorts the directory by size, then file
name</li>
<li class="separate"><code>C=D</code> sorts the directory by description, then
file name</li>
<li><code>O=A</code> sorts the listing in Ascending
Order</li>
<li class="separate"><code>O=D</code> sorts the listing in Descending
Order</li>
<li><code>F=0</code> formats the listing as a simple list
(not FancyIndexed)</li>
<li><code>F=1</code> formats the listing as a FancyIndexed
list</li>
<li class="separate"><code>F=2</code> formats the listing as an
HTMLTable FancyIndexed list</li>
<li><code>V=0</code> disables version sorting</li>
<li class="separate"><code>V=1</code> enables version sorting</li>
<li><code>P=<var>pattern</var></code> lists only files matching
the given <var>pattern</var></li>
</ul>
<p>Note that the 'P'attern query argument is tested
<em>after</em> the usual <code class="directive"><a href="#indexignore">IndexIgnore</a></code> directives are processed,
and all file names are still subjected to the same criteria as
any other autoindex listing. The Query Arguments parser in
<code class="module"><a href="../mod/mod_autoindex.html">mod_autoindex</a></code> will stop abruptly when an unrecognized
option is encountered. The Query Arguments must be well formed,
according to the table above.</p>
<p>The simple example below, which can be clipped and saved in
a header.html file, illustrates these query options. Note that
the unknown "X" argument, for the submit button, is listed last
to assure the arguments are all parsed before mod_autoindex
encounters the X=Go input.</p>
<div class="example"><p><code>
<form action="" method="get"><br />
<span class="indent">
Show me a <select name="F"><br />
<span class="indent">
<option value="0"> Plain list</option><br />
<option value="1" selected="selected"> Fancy list</option><br />
<option value="2"> Table list</option><br />
</span>
</select><br />
Sorted by <select name="C"><br />
<span class="indent">
<option value="N" selected="selected"> Name</option><br />
<option value="M"> Date Modified</option><br />
<option value="S"> Size</option><br />
<option value="D"> Description</option><br />
</span>
</select><br />
<select name="O"><br />
<span class="indent">
<option value="A" selected="selected"> Ascending</option><br />
<option value="D"> Descending</option><br />
</span>
</select><br />
<select name="V"><br />
<span class="indent">
<option value="0" selected="selected"> in Normal order</option><br />
<option value="1"> in Version order</option><br />
</span>
</select><br />
Matching <input type="text" name="P" value="*" /><br />
<input type="submit" name="X" value="Go" /><br />
</span>
</form>
</code></p></div>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="AddAlt" id="AddAlt">AddAlt</a> <a name="addalt" id="addalt">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>Alternate text to display for a file, instead of an
icon selected by filename</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>AddAlt <var>string</var> <var>file</var> [<var>file</var>] ...</code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
<tr><th><a href="directive-dict.html#Override">覆盖项</a></th><td>Indexes</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>基本(B)</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td>mod_autoindex</td></tr>
</table>
<p><code class="directive">AddAlt</code> provides the alternate text to
display for a file, instead of an icon, for <code><a href="#indexoptions.fancyindexing">FancyIndexing</a></code>.
<var>File</var> is a file extension, partial filename, wild-card
expression or full filename for files to describe.
If <var>String</var> contains any whitespace, you have to enclose it
in quotes (<code>"</code>或<code>'</code>). This alternate text
is displayed if the client is image-incapable, has image loading
disabled, or fails to retrieve the icon.</p>
<div class="example"><h3>例子</h3><p><code>
AddAlt "PDF file" *.pdf<br />
AddAlt Compressed *.gz *.zip *.Z
</code></p></div>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="AddAltByEncoding" id="AddAltByEncoding">AddAltByEncoding</a> <a name="addaltbyencoding" id="addaltbyencoding">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>Alternate text to display for a file instead of an icon
selected by MIME-encoding</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>AddAltByEncoding <var>string</var> <var>MIME-encoding</var>
[<var>MIME-encoding</var>] ...</code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
<tr><th><a href="directive-dict.html#Override">覆盖项</a></th><td>Indexes</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>基本(B)</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td>mod_autoindex</td></tr>
</table>
<p><code class="directive">AddAltByEncoding</code> provides the alternate
text to display for a file, instead of an icon, for <code><a href="#indexoptions.fancyindexing">FancyIndexing</a></code>.
<var>MIME-encoding</var> is a valid content-encoding, such as
<code>x-compress</code>. If <var>String</var> contains any whitespace,
you have to enclose it in quotes (<code>"</code>或<code>'</code>).
This alternate text is displayed if the client is image-incapable,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -