我的.htaccess文件去年还在运行,据我所知我还没有修改过它。但是,我现在收到以下错误:
AuthType not allowed here
我的.htaccess文件如下所示:
AuthType Basic
AuthName "Password Protected Area"
AuthUserFile /pwd/.htpasswd
Require valid-user
如果它对我的这个域的主apache .conf文件有帮助,如下所示:
<VirtualHost *:80>
ServerAdmin webmaster@example.com
ServerName subdomain.example.com
DirectoryIndex index.html index.php
DocumentRoot /var/sites/example.com/subdomain
LogLevel warn
ErrorLog /var/sites/example.com/log/error.log
CustomLog /var/sites/example.com/log/access.log combined
</VirtualHost>
你知道问题出在哪里吗?
发布于 2018-06-09 03:16:40
不允许"here“的AuthType
(和其他指令)几乎肯定是一个缺失的AllowOverride
,它允许.htaccess
文件覆盖这些指令。
https://httpd.apache.org/docs/current/mod/core.html#allowoverride
AllowOverride
只适用于<Directory>
部分。解决方案可能如下所示:
<Directory "/var/sites/example.com/subdomain">
AllowOverride All
</Directory>
这将只允许在/var/sites/example.com/subdomain
目录中覆盖.htaccess
。
<Directory>
指令已经存在,您可能希望修改它,而不是添加新指令。此搜索有助于在大多数Linux系统上找到它:
grep -r "Directory" /etc/httpd/
https://stackoverflow.com/questions/44360038
复制相似问题