So you have your website up and running, but for one reason or another, you want to block a country IP address. If you are at a loss when it comes to blocking certain countries or IP addresses from accessing your website, then you are in the right place. Today, I will show you how to easily accomplish this by using a smooth, lightweight plugin that is easy to configure.
What is an IP Address?
As simple as I can put it, an IP address is a unique string of numbers that is separated by periods. These numbers are used to identify computers using the Internet Protocol to connect and communicate over a network.
If we break it down even more and make it easier to understand, an IP address is actually a label. This label is used to identify all types of devices on a computer network, like the Internet.
Think of it as a postal address, except for computers. The number is written in binary, and it can tell someone where a device is accessing the web. Each address has two parts. One part specifies the computer or group of computers, while the other part specifies the network.
Why Block Country IP Addresses?
Actually, blocking IP addresses is not limited to countries. You may want to block a number of IP addresses for one reason or another. The thing is, sometimes you want to block a country’s IP range because you simply don’t have a website that is tailored toward that area of the world.
Other times you may want to block IP addresses for more personal reasons. Here are some good examples.
Say you own a local store and your primary market is locally and throughout your state. There is no need to allow other countries to index or waste bandwidth on your server. You simply want your site accessible to your market.
Or, in another case, you may run a personal, or private website. This could include a family blog or a private members-only site that you want to restrict traffic. Using WordPress to block an IP is ideal here as well.
Perhaps you may want to ban or block IP addresses that are known for spamming, mining, data, or hack attempts.
Whatever your reason may be, there is a fantastic plugin we are going to go over that will allow you to easily block a country’s IP address. It will also allow you to block any IP address for that matter.
Let’s take a look at the plugin and see what all it does.
Login IP & Country Restriction
The Login IP & Country Restriction plugin gives website owners the ability to limit and block country’s IPs in WordPress. The plugin also allows you to block or allow individual IP addresses.
Overall, it allows you to easily restrict access to website content how you see fit.
Once the plugin is installed, you can begin choosing which countries will be allowed access to your website and which will not. If you have been looking for a simple solution to block country IP addresses, this is it.
Login IP & Country Ban comes with a lot of features. Some of the main ones include:
- Ability to ban visitors from countries you select.
- Ability to whitelist visitors based on individual IP Addresses.
- Allow certain IP addresses from countries you have blocked.
- Redirects users to the homepage when a restriction is detected.
- Totally free to use.
If you are looking for an easy-to-use solution for blocking country IP addresses, then Login IP & Country Restriction is a great choice.
Let’s take a look at how to install the plugin and get it going on your WordPress website.
Step 1: Install and Activate Plugin
In order to start blocking country IP addresses, you first need to install and activate the plugin. You can do that by navigating over to the Plugins page in your WordPress admin dashboard.
Simply search the name of the plugin and click on the “Install Now” button.
Once the plugin has been installed and activated, click on Settings and select the Login IP & Country Restrictions Settings option.
This takes you to the main settings for the plugin. Here, we will go through what is available together and get the plugin going on your website.
Step 2: Configure the Settings
At this point, you should be on the main page settings for the plugin. You will see that there are 6 tab-like links available to go through and configure. These include:
- Rule Type
- IP Restriction
- Country Restriction
- Other Settings (Pro Version Only)
Let’s go through these together and get you up and running with the plugin.
Note: This tutorial is based on the free version available to use. I will not cover the Pro features.
Select A Rule Type
Here, you need to select how the IP ban will behave.
For instance, let’s say you select the United States as an allowed country. The rule you select will determine what happens to that country. By default, option 3, Allow login only for allowed countries or allowed IPs, is selected.
This would mean that only IP addresses from the United States will be allowed to log in to your website. This can be a bit tricky, but if you keep it set to the above rule, and select which IP addresses to allow, it is very straightforward.
The other options are very handy, but they are more complicated to work with.
The Ip Restriction section is all about either blocking or whitelisting individual IP addresses. By default, there are no IP restrictions. Click on the Setup IP Restriction, if you wish, and enter the IP addresses into the correct box separated with a comma.
Click on the “Save Changes” button to finish.
The main feature of the plugin is to block countries. By default, no countries are selected.
To begin selecting countries, click on the Setup Country Restriction. You will now have access to a full list of every country, which you can view alphabetically.
Simply go through every country you want to allow or block and click on the “Save Changes” button when finished.
The redirects section is all about setting up redirects. Or more specifically, redirecting users who try to log in that are blocked. By default, redirects are turned off. To turn them on, click on the Setup Redirects option.
There are two options. The first is for logins and it will send them back to the home page. The second option is for registration and will send them back to the home page as well.
Select the options you want to use and save the changes.
This section is exclusive to the Pro version. This is where you will find all of the additional features like lockout durations and more. Click on it to see a full list of features.
Lastly, the Debug section exists to help you troubleshoot the plugin. Most users will never need to use this section and to be honest, most won’t know how to use it.
For those who do, you can paste JSON code here to import it or reset the settings to default.
That’s it, the plugin is now ready to go. It is now up and running and you should have a lot more control over who sees your website and who doesn’t.
If you have the right plugin and know how to use it, then having the ability to block country IP addresses is not difficult. If you don’t want certain people accessing your website content, then the Login IP & Country Restriction plugin is exactly what you need.
Not only will you be able to be more private with your site, but it is also easy to set up. Now you can block and redirect IP addresses from anywhere in the world the way you see fit.
Have you ever tried to block an IP address using another process? Have you found that things run smoother on your website if you can block IP addresses?