Are you concerned about the security of your WordPress site? and want to secure the WP Administrative panel? Restrict admin access by IP Address is an effective way to secure your WordPress admin panel. In this tutorial, we’ll show you how to restrict WordPress admin access by IP using HTACCESS.
The following example shows how you can allow access from a specific IP address to wp-admin. It is very useful when you want to allow access only from your IP address.
Create a new .htaccess
file and upload to the wp-admin directory. Now insert the following code in wp-admin/.htaccess
file.
order deny,allow allow from 172.94.37.33 deny from all
If you want to allow access to wp-admin from multiple IP addresses, list them as allow from IP on each new line.
allow from 172.94.37.33 allow from 192.210.161.111 allow from 198.46.154.184
If you don’t want to block every IP but specific IP to access WP Admin, you can block that IP address individually using the .htaccess file.
Create a new .htaccess file and upload to the wp-admin directory. Now insert the following code in wp-admin/.htaccess
file.
order allow,deny deny from 198.46.154.184 allow from all
You can limit access to the wp-login.php
file by IP address using HTACCESS. Open the main .htaccess file and insert the following code at top of the file.
<Files wp-login.php> order deny,allow Deny from all # allow access from my IP address allow from 172.94.37.33 # allow access from my IP address allow from 192.210.161.111 </Files>
Note that: Don’t forget to replace the IP address with your own.
Do you want to get implementation help, or enhance the functionality of this script? Click here to Submit Service Request
Thank you for sharing this very useful WP code snipper.
very helpful content for me. Thanks for sharing
This is very helpful to prevent anyone except the owner to Access the Admin Login Area.