Protect Your WordPress Admin with IP blocking in .htaccess

Protect Your WordPress Admin with IP blocking in .htaccess

If your website is setup on WordPress it’s going to be a target for hackers. Here is one method to help alleviate some of the attempts hackers commonly use to try to gain access to your WordPress:

Protect with .htaccess

What is .htaccess? – this is a file in your website directory that allows you to protect viewing of certain files or directories on your website.

In this case we are going to allow only Your IP address to access admin directory in WordPress which is where hackers try to break into so they can upload files

Step 1. Access your hosting control panel account (or ftp to your website)
Step 2. Find your /wp-admin directory and open it
Step 3. Find the .htaccess file and open it
Step 4. Add the following code:

AuthName wp1234

AuthType Basic

<Limit GET POST>

order deny,allow

deny from all

allow from (put your IP here without the parentheses)
allow from (put another IP you want to have access here without the parentheses)


If you don’t have a .htaccess file make sure to create one with that code.

How do I find my IP Address? Go to and it will show it to you there.

What if my IP changes? – If your IP changes simply go back and update the file with your new IP address following the same steps above.

I don’t know how to do this (or I’m a bit nervous about doing it myself) – If you want help with this we offer the service for $25 to install the code. Click here to make a request:Contact WebsiteService4All

FYI: This is one piece of protecting your website from hackers. It won’t cure every hacking attempt but it’s a really good start.