我的htaccess根目录中有以下内容,运行Apache 2.4.46
Order Allow,Deny
Allow from all
Deny from 1.2.3.4 # block hackers
RewriteCond %{QUERY_STRING} (^|&)id\=549($|&)
RewriteRule ^index3211\.html$ /donate/? [L,R=301]
<Files wp-login.php>
AuthName Limited!
AuthType Basic
AuthUserFile "/home/example/www/www/wp-admin/.htpasswd"
Require valid-user
</Files>
...
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
<Files ".user.ini">
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
</Files>
但是在某些普通的WP页面中(在没有引用wp-login的index.php的友好URL上),系统提示我输入密码。
页面加载,密码提示仅出现在末尾。我在Javascript源,HTML或“网络”标签请求中都找不到对wp-login.php的引用(并且没有重定向)。
关于诊断的任何提示吗?
更新:我们已将其跟踪到WPBakery Media Grid元素。我找不到实际的连接,所以不知道它是如何触发/在何处触发的,但是可以使用元素打开和关闭该问题。
答案 0 :(得分:1)
您可以在.htacess中尝试以下代码:
<If "%{THE_REQUEST} =~ m#/login\.php[/?\s]#">
AuthName Limited!
AuthType Basic
AuthUserFile "/home/example/www/www/wp-admin/.htpasswd"
Require valid-user
</If>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
确保在新的浏览器中或清除浏览器缓存后进行测试。