PHP help needed : To block Wordpress admin page to all except ip range

mk76

Adept
** To start.. I have zero PHP skills **

For my wordpress site, I had modified htaccess and added code that would block wp-admin page to all except one IP address. It worked fine till I changed my ISP recently and have now dynamic IP assigned. It has very small lease time ... changing my IP daily.

Code:
# BEGIN : REDIRECT ADMIN LOGIN FROM OTHER IP
#    RewriteCond %{REMOTE_ADDR} !^xxx\.xxx\.xxx\.xxx$ ---> Worked ok with static IP
    RewriteCond %{REMOTE_ADDR} !^xxx\.xxx\.$  ---> Want something like this to work
    RewriteRule ^wp-(login|register)\.php http://websiteaddress [R,L]
# END : REDIRECT

Need help to enhance above code .. or use something else to block IPs
 
Back
Top