How To Limit Access To WordPress Login By IP With .htaccess

In last tutorial, I showed you how to limit access to your WordPress’ admin panel by IP address. You can also limit access to WordPress login by IP address with a tweaked version of that code. Only a certain IP will be able to access your wp-login.php file.

Add following code to the .htaccess file of your root folder, or create one:

<Files wp-login.php>
Order deny,allow
Deny from all
Allow from xx.xx.xx.0/24
#Another IP
Allow from xx.xx.xx.xx

Replace xx.xx.xx.xx with your current IP address. To know your IP address, you can use an online service such as What Is My IP.

If you found this post useful, share it with your friends:

Leave a Reply