加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – 使用AuthType Basic登录后出现.htaccess 500错误

发布时间:2020-12-13 22:20:57 所属栏目:PHP教程 来源:网络整理
导读:这是我的.htaccess文件: AuthType BasicAuthName "LOG IN"AuthUserFile .htpasswdRequire valid-user 登录后,我收到500错误.如果我清除.htaccess文件,它工作正常. 有任何想法吗? 解决方法 我想你必须写你的.htpasswd的完整路径(在linux上:/path/to/.htpas
这是我的.htaccess文件:

AuthType Basic
AuthName "LOG IN"
AuthUserFile .htpasswd
Require valid-user

登录后,我收到500错误.如果我清除.htaccess文件,它工作正常.

有任何想法吗?

解决方法

我想你必须写你的.htpasswd的完整路径(在linux上:/path/to/.htpasswd)

从http://weavervsworld.com/docs/other/passprotect.html起

Troubleshooting

Make sure that the path specified in AuthUserFile is the correct full
path. This is a major cause of problems. If Apache cannot find the
.htpasswd file,then all attempts will fail.

Make sure the permissions
on the .htaccess and .htpasswd files are set so that Apache can read
them. chmod 0644 .htaccess chmod 0644 .htpasswd

Other issues may be out of your control. Web administrators can lock down Apache so that it ignores all .htaccess files it encounters. This can be achieved with an AllowOverride None directive and option on the ServerRoot/DocumentRoot directories. If this is the case (.htaccess not allowed) you will have to kindly ask your web administrator to allow .htaccess files with authorization directives in your personal web directory. This can be achieved with AllowOverride AuthConfig directive and option.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读