即使存在 DirectoryIndex 文件,也强制列出 Apache 目录

Jak*_*les 6 directory-listing apache-2.2

即使存在索引文件,如何配置 Apache 以列出目录中的文件?

例如,如果我有一个/var/foo包含多个文件的目录,其中一个是目录索引(index.html、index.php 等),我如何让 Apache 显示目录列表而不是显示内容index.html,当用户浏览到http://example.com/foo/?

# Directory listing for /var/foo/, mapped to http://example.com/foo/
..
.
code.c
readme.pdf
index.html
Run Code Online (Sandbox Code Playgroud)

我使用了以下方法,但我想有更好的方法:

Options +Indexes +MultiViews
DirectoryIndex will-never-exist.xyz
Run Code Online (Sandbox Code Playgroud)

Sel*_*vel 5

您可以将DirectoryIndex选项留空或关闭dir_module模块。