【发布时间】:2021-10-11 01:31:19
【问题描述】:
我不知道为什么 .htaccess 文件没有被读取。我正在使用 XAMPP
这里是 httpd.conf 文件
DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs">
Options None
AllowOverride All
Require all granted
</Directory>
我不想启用内容列表,除了一个名为照片的文件夹。 所以在 htdocs 内的照片目录中 - 使用记事本我创建了一个 .htaccess 文件并包含
#Allow the listing of folder content
Options All
这不起作用,错误日志显示:
Cannot serve directory C:/xampp/htdocs/photos/: No matching DirectoryIndex (home.php,home.html,home.htm,index.php,index.html,index.htm) found, and server-generated directory index forbidden by Options directive
我还在访问文件的开头添加了垃圾,以查看它是否会重现错误,但它说的只是 403 禁止。
我尝试过的其他事情是
#Allow the listing of folder content
Options Indexes
基本上,对于每个文件夹,除了照片文件夹之外,不应该有任何内容列表,这就是我创建 .htaccess 文件并将其放在照片文件夹中的原因。 (必须是 .htaccess)
任何想法为什么这不起作用?
【问题讨论】: