Protect Your Admin folder in WordPress by Limiting Access in .htaccess

Michael Oldborn

There are challenges that bother us as well as amenities in the digital world. The reason why it is that is because of hackers in the digital world and malicious people who are constantly trying to harm you. One of our visitors recently reported that the WordPress site’s wp-Admin folder was hacked to be taken. There are some extra precautions you should take in case you face such situations.

You may limit accesses to your wp-admin login page, assignig some specific IP’s in your .htaccess file. The reason for such attacks is that hackers can access to your wp-admin login page. So, you can allow ony for a limited amount of person who you want to access to your wp-admin page.

To prevent this attack, first you need to open the .htaccess file in your wp-admin folder and have a backup of this file.

Note! Please do not either edit your root.htaccess folder or copy paste the following snippet codes into this folder. There should be a .htaccess file in this folderand copy paste the following snippet code into this file.

AuthUserFile /dev/null

AuthGroupFile /dev/null

AuthName "WordPress Admin Access Control"

AuthType Basic


order deny,allow

deny from all

# whitelist Syed's IP address

allow from

# whitelist David's IP address

allow from

# whitelist Amanda's IP address

allow from

# whitelist Muhammad's IP address

allow from

# whitelist Work IP address

allow from


Add your IP address and save it. if you have more than one IP, be sure to list them as shown above. In this article, we tried to show how you can limit wp-admin folder access by IP address using the .htaccess file. You may let us know your feedback leaving a comment under this article.