How to Block an IP Address from Your Website
I was recently working on a project where I needed to temporarily block an IP address on our site. Our web host provides us with the ability to block unwanted IP addresses from our site, so we implemented their service. Now when someone tries to access our site from an IP address that has been blocked, they see this:
An example of a blocking message from Web HostingHub They won’t see anything because we have their IP blocked (hence the name — hide my IP). But what happens if they try to access a different site that is also hosted by our web host? The answer is that their IP address will still be blocked, but this time it will also block access to every other site that they host. So if they have a personal blog or a small business website that they don’t want people to see, then this is the service for them. Here’s how to do it. We need to decide which web host to use for this project, and for the sake of this tutorial we are going to go with the well-known and trusted Bluehost. You can’t go wrong with Bluehost, especially if you are looking for a web host that provides you with all the features you need and doesn’t cost you an arm and a leg. (We will discuss more affordable web hosts later on in this guide.) When you sign up for Bluehost, you will see this message: Sign up for Bluehost If you click the box that pops up, you will be taken to their payment page, where you can select how many websites you want to host with them. For the sake of this tutorial, we are going to select the Basic plan, which costs $2.95 per month. This plan comes with all the features you need and doesn’t require you to build your own website. Now that you have your web host, you need to setup your block list. This is a list of IP addresses that you want to block from accessing your website. You will need to put the IP address of your web host in here. So if your web host’s IP is 123.456.789.10, then you would put 123.456.789.10 into your block list. You can add other IP addresses here as well, such as those of guest bloggers who want to post on your behalf. For the sake of this tutorial, we will only add the IP address of our web host to the block list. When someone tries to access our site with an IP address that is on our block list, we will see this message: An example of a blocking message from a blocked IP address So if someone tried to visit our site with an IP address of 123.456.789.10, we would see this message: An example of a blocked IP address They will see a page stating that their IP address has been blocked and that they can’t access our site with this IP address. If they try to visit a different website that is also hosted by our web host, then their IP address will be added to that site’s block list as well. So if they have a block list that includes 123.456.789.10 and 567.890.123.45, then anyone trying to access that site will also see this message. Once you have setup your block list, you need to test it. Go back to your web host, and try to visit a different site from your block list. If someone tries to visit a site that is on your block list, then their IP address will be blocked and they will see a message similar to the one below. An example of the testing message from a blocked IP address This message is a good test of your block list; you can’t access the site you are trying to protect, but you can see that their IP has been blocked and that they can’t access other sites either. (If someone is attempting to hack your site or steal content, then they will be trying to gain access with an IP address that is not on your block list. So if you see this message when they aren’t supposed to, then they have successfully accessed your site without your permission.) Even though we are using a trusted web host that already provides you with decent security, there is still one more step you can take to make your site even more secure. If you have an extra dollar or two a month, then you can sign up for a free VPN that encrypts your web traffic and hides your internet activity. When you use a VPN, your IP address will be that of the VPN server, which will hide your actual location. So if someone from another country tries to access your site, they won’t know where you are. (You will need to configure your VPN to automatically connect to the server located in your country when you sign up, but after that, you can access the site without any problems). The advantage of using a VPN is that even if someone does gain access to your site (either accidentally or on purpose), they will have a hard time stealing content or disrupting your business. (At least, not without also getting access to the VPN server, which might be a little more difficult.) So, using a VPN isn’t vital, but it certainly couldn’t hurt. One issue that can arise is when someone creates a signup form for your site, but doesn’t actually have an account. They will then try to sign up with a fake email address, to make it look like they are a real person, or use a spoofing IP address to make it look like they are from another country. (A site with a lot of signups from fake accounts will start to look suspicious; people will wonder if something is wrong.) To prevent fake signups, you can require people to sign up with their social media accounts. That way, you know for sure that they are who they claim to be. (You can also ask for their name and email, then check the email for consistency). If you find that people are creating fake accounts to get access to your site, then you can request that they be removed. (This is usually a futile effort, however; people will just create more fake accounts.)Choose A Web Host That Provides Blocking Services
Setup Your Block List
Test Your Setup
Optional: Use A Free VPN To Improve Your Security
How To Prevent Fake Signups