This the code I have in the BPS Custom Code area (specifically, in the CUSTOM CODE BOTTOM HOTLINKING/FORBID COMMENT SPAMMERS/BLOCK BOTS/BLOCK IP/REDIRECT CODE section). I included the code in the Custom Code area rather than writing it directly into the htaccess file so I don’t have to re-edit my htaccess file every time BPS is updated. Until I experienced my current issue, the code has not caused any issues with logging in/out since I started using it several months ago.
<FilesMatch "^(wp-login\.php)">
Order deny,allow
Deny from all
Allow from xxx.xxx.xxx.xxx
Allow from yyy.yyy.yyy.yyy
Allow from zzz.zzz.zzz.zzz
</FilesMatch>
The 3 static IPs I have in this code are those for the server IP and 2 public IPs.
Having experienced the log in problems described in this thread, and having been alerted to this BPS Forum thread when I recently upgraded to 49.2, as an experiment I tried using the following code from that thread (in the same Custom Code section) instead of the code I’d previously been using:
# Protect wp-login.php from Brute Force Login Attacks based on IP Address
<FilesMatch "^(wp-login\.php)">
Order Allow,Deny
# Add your website domain name
Allow from (my domain name is inserted here)
# Add your website/Server IP Address
Allow from xxx.xxx.xxx.xxx
# Add your Public IP Address using 2 or 3 octets so that if/when
# your IP address changes it will still be in your subnet range. If you
# have a static IP address then use all 4 octets.
# Examples: 2 octets: 65.100. 3 octets: 65.100.50. 4 octets: 65.100.50.1
Allow from yyy.yyy.yyy.yyy
Allow from zzz.zzz.zzz.zzz
</FilesMatch>
Replacing my code with your code made no difference, however.
Using either “whitelist” code, logging out from the Dashboard does not complete – the browser URL reads
domainname/wp-login.php?action=logout&_wpnonce=[10alphanumericcharacters]
and the 403 page is displayed. As noted earlier, the only way to log back in is to delete the htaccess file. If I then refresh the BPS 403 page being displayed, the browser URL changes to read
domainname/wp-login.php?loggedout=true
and the login page is presented. Once logged back in, I can then re-create and re-activate BPS htaccess security mode.
I have also tested including my code on other websites I maintain and the result is the same – once logged out (or a log in time limit has expired) any attempt to log back in from a whitelisted IP results in the display of the BPS 403 page as above.
The only other change I’ve made recently to the htaccess file on my websites, is to include this code in the CUSTOM CODE REQUEST METHODS FILTERED section (as recommended when I updated to 49.2):
# REQUEST METHODS FILTERED
# This filter is for blocking junk bots and spam bots from making a HEAD request, but may also block some
# HEAD request from bots that you want to allow in certains cases. This is not a security filter and is just
# a nuisance filter. This filter will not block any important bots like the google bot. If you want to allow
# all bots to make a HEAD request then remove HEAD from the Request Method filter.
# The TRACE, DELETE, TRACK and DEBUG request methods should never be allowed against your website.
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^(TRACE|DELETE|TRACK|DEBUG) [NC]
RewriteRule ^(.*)$ - [F,L]
I hope this additional information assists.