【问题标题】:Apache DirectoryIndex not working for subfolderApache DirectoryIndex 不适用于子文件夹
【发布时间】:2014-09-28 17:34:09
【问题描述】:

我正在使用 .htaccess 文件为文件夹设置一些选项,但 DirectoryIndex 规则似乎在子文件夹中不起作用。这是我的 .htaccess 文件。

AuthUserFile /var/www/.htpasswd
AuthType Basic
AuthName "Folder"
Require user joe
DirectoryIndex index.htm index.html

我知道它正在加载 .htaccess 文件,因为如果我尝试直接转到子文件夹,它会要求输入密码,但它不会加载其中的 index.htm 文件,我必须手动输入 index.htm。带有 .htaccess 文件的根文件夹会自动加载 index.htm 文件。我错过了什么?谢谢!

【问题讨论】:

  • 当你去你的子文件夹时,你是去http://example.com/subfolder还是http://example.com/subfolder/(斜杠)?

标签: apache .htaccess directoryindex


【解决方案1】:

原来是乘客造成了问题。解决方案是禁用该文件夹的乘客。

<Location /public>
    PassengerEnabled off
</Location>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-23
    • 2018-12-13
    相关资源
    最近更新 更多