我试图停止Apache(Ubuntu)中的特定目录的目录索引,并将以下内容放在我的.htaccess文件中:
<Directory /var/www/xyz> Options -Indexes </Directory>
这阻止了整个网站。 为什么?
因为.htaccess中的Options -Indexes是recursion的,所以相当于
<Directory /your/root/> Options -Indexes </Directory>
如果你想禁止索引只为一个特定的目录没有recursion只是把一个空的index.html文件,并确保DirectoryIndex指令设置为index.html。
你把.htaccess文件放到你要禁用的目录中?