whitelist your ip

How to Permanently Whitelist an IP Address to access WordPress Dashboard?

Security is the very important one for every website. It is like someone trying to access your files and datas without your permission or authentication. So it is your responsibility to make sure you have set some strong defence to prevent your website from other persons or hackers.

If you are using the WordPress CMS, then there are plenty of ways to protect your website. Most of the times you must protect the login details and dashboard through which the attack takes place easily. There are various WordPress Security plugins available for free and pro to protect your website from attacks and thefts. In this article, I have explained all about “How to Permanently Whitelist an IP Address to access WordPress Dashboard?”

What is Whitelisting?

If you are whitelisting an IP Address then the computers with different IP address can’t access your dashboard. For example: If you are running a website by yourself and if you have some static IP Address, then you can whitelist the particular ip address. As the computers will access the internet through IP Address, no other system with different IP Address can’t access your website. So you must be very careful while choosing this option.

website security

Do you know what is Blacklisting? Blacklisting an IP Address will just block them from accessing your website. But the computers with IP Address which is not present in the blacklist can access the internet. Also, instead of identifying and blacklisting all harmful attackers, it is better to whitelist the set of IP Address.

How to Whitelist an IP Address to Access Your WordPress Dashboard?

It is recommended to take the precautions before doing any changes in the main files of your website. As a precaution you can take backup of your entire website. Now we going to tweak one of the wordpress core files.

  • Static IP Address

One of the important thing to whitelist an IP Address is that, you must have a Static IP Address. Because if you don’t have an static IP Address, then you won’t have any constant IP which will be keep on changing. So check twice or thrice whether everyone in your team is using the static IP Address. If you save the wrong IP Address, then you can’t access your dashboard at all. So it is important to check before using it.

website security

Suppose if you have problems in choosing the exact IP Address to whitelist it, then it is recommended to choose the VPN Providers who will offer dedicated IP Address. So using the VPN you can access your dashboard.

It is very much secured because, no other person can access a machine with your IP Address and even you can access the dashboard using different IP Address.

  • Edit Your .htaccess File

Now we going place few lines of code in .htaccess file to whitelist the IP Address. You can access your .htaccess file through cPanel or FTP Access. There are some SEO Plugins which allows you to add codes in htaccess files.

In .htaccess file, there will be some default wordpress codes. Beginning and end of the code will be mentioned as # BEGIN WordPress & # END WordPress. 

Here add the below code in your .htaccess file, just above the “# END WordPress“.

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} ^(.*)?wp-admin$
RewriteRule ^(.*)$ – [R=403,L]

In the above code, replace the “FIRST_IP_ADDRESS” with one of your IP Address and replace the “SECOND_IP_ADDRESS” with another IP Address.  If you want to add more IP Address then you can replicate the particular line and replace it with your different IP Address.

Finally, save the .htaccess file. You have whitelisted the particular IP and no one can access your dashboard from the unlisted ip address.