【问题标题】:HTTP authentication works in firefox but not on google chromeHTTP 身份验证在 Firefox 中有效,但在 google chrome 中无效
【发布时间】:2014-03-05 22:56:31
【问题描述】:

我有一个使用带有 .htaccess 的 http 身份验证的网站 这在 Firefox 中完美运行,但它不适用于使用正确密码的 Chrome。

.htaccess 代码

AuthUserFile /web/posefauxcils/revuedigitale/htpasswd.txt
AuthName "Acces protege"
AuthType Basic
Require valid-user

htpasswd.txt 中的密码用

加密
crypt($_POST['pass'], '4kp')

【问题讨论】:

  • “不起作用”没有帮助,究竟是什么,没有发生什么?
  • 浏览器要求用户和密码访问网站。用firefox,没问题,我进入网站。使用谷歌浏览器,我输入了正确的用户名和密码,但它再次要求提供凭据。
  • 我尝试输入加密的密码,但没有更改

标签: php html .htaccess google-chrome


【解决方案1】:

尝试将您的文件 htpasswd.txt 更改为 .htpasswd

.htaccess 应该包含:

AuthName "Page d'administration protégée"
AuthType Basic
AuthUserFile "/home/site/www/admin/.htpasswd"
Require valid-user

然后在 .htpasswd 中:

login:crypted_passord

查看加密密码:

<?php echo crypt('yourpass'); ?>

【讨论】:

  • 我尝试更改文件名和 .htaccess 但没有更改:/
猜你喜欢
  • 1970-01-01
  • 2022-01-18
  • 2016-02-19
  • 2022-01-23
  • 1970-01-01
  • 2017-10-21
  • 2016-09-22
  • 2013-03-21
  • 2020-04-04
相关资源
最近更新 更多