受.htaccess文件保护的文件访问没有将密码存储在.htpasswd文件中?

问题描述 投票:1回答:2

我在Magento root中尝试过它

AuthUserFile /home/username/public_html/.htpsswd
AuthType Basic
AuthName "restricted area"

<files "index.php" >
    Require valid-user
</files>

我尝试通过上面的代码保护.htaccess文件访问index.php文件

我通过php代码在AuthUserFile上找到基本路径

<?php
echo getcwd();
 ?>

这是我的.htpsswd文件

admin:admin

每当我输入密码时,它会显示一次又一次要求输入密码的弹出窗口

apache .htaccess configuration-files server-configuration
2个回答
1
投票

这通常在密码不正确时发生。将.htpasswd文件的内容更改为:

admin:$apr1$ol.jlx5P$ldshyeA.03GTKJWGFgQYH/

现在您应该可以使用以下命令登录:用户名:admin密码:admin

如果这不起作用,请检查并确保.htpasswd文件的路径正确。


0
投票

工作完美,文件名(拼写)错误..

© www.soinside.com 2019 - 2024. All rights reserved.