Skip to content

How To Limit Access To WordPress Admin Panel By IP With .htaccess

In some future articles, I’m looking forward to talk about security and stuff. So, before I post them on this website, it’s more important to write all the basic stuff. In this article, I’ll show you how to limit access to WordPress admin panel by IP address with your .htaccess file. After using this trick only a certain IP address will be access to access the wp-admin of your WordPress website.

In your /wp-admin folder, add an .htaccess file with the following code in it:

Order deny,allow
Deny from all
Allow from xx.xx.xx.xx
#range would be
#Allow from xx.xx.xx.0/24
<Files admin-ajax.php>
Order allow,deny
Allow from all
Satisfy any
</Files>

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.

Leave a Reply

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