我有IdeaWebServer,我尝试通过.htpasswd保护文件。当我尝试访问我的页面时,登录窗口不会显示。 这是我的.htacces代码
AuthType basic
AuthName "Login"
:Location /users/www/domain.com/wp-login.php
AuthUserFile /users/www/.htpasswd
Access allow all valid-user
:Location
ErrorDocument 401 "Denied"
ErrorDocument 403 "Denied"
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
和.htpasswd
user:passwordcodedinmd5
这是对的吗?
答案 0 :(得分:0)
在htaccess文件中尝试此代码
AuthName "Restricted Access"
AuthType Basic
AuthUserFile file path/.htpasswd
require valid-user