【问题标题】:.htaccess is not being read using XAMPP.htaccess 没有被使用 XAMPP 读取
【发布时间】: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)

任何想法为什么这不起作用?

【问题讨论】:

    标签: apache .htaccess xampp


    【解决方案1】:

    对于遇到这种情况需要帮助的任何人 - 我想通了。

    即使在选择“所有文件”后,记事本仍将其保存为 .htaccess.txt

    要修复这个使用过的括号(您可以使用其他其他软件,如 notepad++)并将其保存在 .htaccess 下,这样就可以了。

    【讨论】:

      猜你喜欢
      • 2012-01-23
      • 2017-05-17
      • 2015-12-02
      • 1970-01-01
      • 2015-06-08
      • 2013-01-16
      • 1970-01-01
      • 2011-04-07
      • 2022-01-23
      相关资源
      最近更新 更多