有趣的事

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

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

隐藏目录下的文件列表:

<Directory "/">
    Options FollowSymLinks
</Directory>
```

 

显示目录下的文件列表:

<Directory "/">
    Options Indexes FollowSymLinks
</Directory>
```

 

也就是在Options后加上Indexes即可。

参考资料:

  • 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

相关阅读