How to restrict access to WordPress login by IP

If you are really committed to the security of your WordPress there is a fantastic method to allow access to your Dashboard only from certain IPs. This method has only one restriction, and that is that authorized users must have a fixed IP, if it were dynamic you might even have problems accessing your own site in case your Internet provider changes your IP.

Now, getting it is really simple, you only have to modify the .htaccess file or create it if it does not exist.

Once you have it you only have to add the following code, replacing the xxx.xxx.xxx.xxx.xxx with your IP address:

<Files wp-login.php>
        order deny,allow
        Deny from all
# Whitelist your IP
allow from xx.xxx.xx.xx
 
# Whitelist other IP
allow from xx.xxx.xx.xx
 
</Files>Code language: PHP (php)

How useful was this post?

Click on a smiley to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

About The Author

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top
Skip to content