我在C:/xampp/htdocs/
下创建了一个名为synchro的目录我已经添加了一个PHP脚本test.php
,其中包含一个web服务,我已经生成了一个密码文件。
和安全的文件夹,我添加了.htaccess
文件,其中包含:
Options +Indexes
AuthUserFile "C:/xampp/htdocs/synchro/passwords"
AuthName "Authentication required"
AuthType Basic
Require valid-user
但是当我尝试执行PHP文件
localhost/synchro/test.php
输入登录名和密码后得到Error 403
我该怎么修理它?
您需要删除AuthUserFile
周围的语音标记。它应该看起来像这样:
AuthUserFile /xampp/htdocs/synchro/passwords
然后需要一个名为.htpasswd
的文件。这将是您创建登录名和密码的地方。
Admin:gl0IiOirI2n6M
所以你的AuthUserFile
看起来像这样:
AuthUserFile /xampp/htdocs/synchro/.htpasswd