Apache中如何隐藏或显示目录下的文件列表

2011-01-04 阅读 59

Apache打开不存在index页面的目录时,随着配置不同,会显示或者隐藏当前目录下的文件列表。参考如下配置,可以实现隐藏或者显示。

隐藏目录下的文件列表:

<pre class="brush:plain;">    <Directory "/">
    Options FollowSymLinks
</Directory>
```
<p>
	&nbsp;</p>
<p>
	显示目录下的文件列表:</p>
<pre class="brush:plain;">    <Directory "/">
    Options Indexes FollowSymLinks
</Directory>
```
<p>
	&nbsp;</p>
<p>
	也就是在Options后加上Indexes即可。</p>
<p>
	参考资料:</p>
  • Options的解释,Configures what features are available in a particular directory
  • Indexes的解释,If a URL which maps to a directory is requested, and there is no DirectoryIndex (e.g., index.html) in that directory, then mod_autoindex will return a formatted listing of the directory.
  • FollowSymLinks的解释,The server will follow symbolic links in this directory.

apache

更新于 2023年03月28日