首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >此处不允许使用AuthType

此处不允许使用AuthType
EN

Stack Overflow用户
提问于 2017-06-05 08:05:24
回答 1查看 4.6K关注 0票数 3

我的.htaccess文件去年还在运行,据我所知我还没有修改过它。但是,我现在收到以下错误:

代码语言:javascript
复制
AuthType not allowed here

我的.htaccess文件如下所示:

代码语言:javascript
复制
AuthType Basic
AuthName "Password Protected Area"
AuthUserFile /pwd/.htpasswd
Require valid-user

如果它对我的这个域的主apache .conf文件有帮助,如下所示:

代码语言:javascript
复制
<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>

你知道问题出在哪里吗?

EN

回答 1

Stack Overflow用户

发布于 2018-06-09 03:16:40

不允许"here“的AuthType (和其他指令)几乎肯定是一个缺失的AllowOverride,它允许.htaccess文件覆盖这些指令。

https://httpd.apache.org/docs/current/mod/core.html#allowoverride

AllowOverride只适用于<Directory>部分。解决方案可能如下所示:

代码语言:javascript
复制
<Directory "/var/sites/example.com/subdomain">
    AllowOverride All
</Directory>

这将只允许在/var/sites/example.com/subdomain目录中覆盖.htaccess

<Directory>指令已经存在,您可能希望修改它,而不是添加新指令。此搜索有助于在大多数Linux系统上找到它:

代码语言:javascript
复制
grep -r "Directory" /etc/httpd/ 
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44360038

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档