How would you restrict the directory access by IP address?

You are here:
← All Topics

If you want to make your admin areas secure from hackers, it’s better to allow access only from the selected IP address to the admin directory. You can just make .htaccess file in your directory where you need to restrict the access by IP Address.

For instance, if your WordPress blog has installed on the main directory such as example.com/wp-admin, it’s better to build .htaccess file in /wp-admin/.htaccess and you need to place this code, and do not forget to replace the allowed IP with your own IP address.

Order deny, Allow
Deny from all
Allow from YOUR-IP-ADDRESS-HERE

(Replace “Your-IP-Address-Here” with the IP Address)

You need to check this out by accessing your /wp-admin IP address from some other IP address that is not allowed by your .htaccess file.