Wil*_*iss 1 directoryindex apache-2.2
如果您访问没有 index.html 的文件夹,Apache 允许您创建目录列表(配置后)。
我想知道的是,是否可以在不同的 URL 处获得相同的列表?我已经在使用 index.html 并希望保持这种状态。
即,这就是我要找的:
http://example.com/blar/-> 加载我的 index.html 页面(不想改变)
http://example.com/blar/directory_list(我希望这个 url 来呈现 apache 目录列表)
我会使用DirectoryIndex指令上的Location覆盖来解决这个问题。
DocumentRoot /var/www
...
Alias /bar /var/www/foo
<Location /bar>
DirectoryIndex disabled
</Location>
Run Code Online (Sandbox Code Playgroud)
现在http://domain.tld/foo/将显示您的 index.html 而http://domain.tld/bar/将为您提供目录索引。假设您的其他配置是这样的。