How to restrict directory access by IP address to your WordPress admin dashboard? Print

In order to secure your admin area from hackers, we recommended you to allow access only from your selected IP to your admin directory. You just need to create an .htaccess file in the directory where you want to restrict access by IP Address.

For example, if you have a WordPress blog installed on your main directory like, you should create an .htaccess file in /wp-admin/.htaccess and you should put this code in, and not forget to replace the allowed IP address with your IP address.

Apache 2.4

<Limit GET POST>
Require all denied
Require ip

Apache 2.2

<Limit GET POST> order deny,allow
deny from all
allow from

You will need to replace the IP address with your IP address which currently is

You can test this by accessing your /wp-admin directory from another IP address which is not allowed by your .htaccess file either by connecting to another wi-fi network or over a mobile phone network

Was this answer helpful?

« Back

Find your perfect domain

Use our domain name search to check your dream domain name

Wide Variety of Domains

Easy Registration Process

Free WHOIS Privacy