How to Block IP Addresses To Protect Your Website

Today I’m going to tell you how to block an IP address from accessing your sites in cPanel. Let’s get started! Now as cool as the internet is, sometimes there are just people who want to do really really dumb things, and if you want to prevent someone from accessing your website from a specific domain or IP, there’s a really easy way to do that in cPanel. I’m going to show you how to do that today.

How to Block IP Addresses

How to Block IP Addresses To Protect Your Website

I’ll start out here in cPanel. What I’m going to do is, in the quick search function, type in IP.

IP blocker

You can also go down to the security section. We’ll click on the IP blocker. Now what IP blocker is going to do is actually prevent access from that IP or whatever IP address you add to all of the sites on your Cpanel. All it’s asking for here is an IP address or a domain. If it’s a domain it’s going to attempt to find out which IP address that domain is associated with.

I’m going to paste that IP address here. It’s a bot. I really don’t want it crawling my site. I want to block it just to make sure that I don’t use any extra resources. Paste that IP address here and click add.

Also Read:

How to Reset a WordPress Password from phpMyAdmin

You’ll see an awesome message up here that says, ‘users from this IP address will not be able to access your site’. I’m going to click ‘Go Back‘, scroll down here and I’ll see that this IP address is officially blocked from accessing any of the sites on my server.

Block IP Addresses From cPanel

Add an IP or Range
Add an IP or Range

What this is actually doing is adding a deny rule into your .htaccess file. If I go to files, and I go into my file manager I can actually show you where this is taking place in your server. I’m going to click on ‘File Manager‘.

This is all the information and data that I have inside of my server. I’m going to scroll down until I find Public_HTML. I’m looking for my .htaccess file now. If you don’t see a .htaccess file, click up here into ‘Settings‘.

Make sure that ‘Show Hidden Files‘ is active. What I’m going to do is right-click on top of this .htaccess and click ‘view‘. It’s a whole bunch of information here, but this is likely going to be down at the bottom. You can see in this ‘deny from‘ that IP address at the bottom. This is what’s effectively blocking that IP address from viewing or accessing my site.

It can save you a lot of resources and save you a lot of hassle if you just have someone who’s not trying to do good stuff on your site. And that’s it! I hope you found this helpful. If you have any questions or comments, please leave them below and stay with us if you want to see more.

Leave a Reply

Your email address will not be published. Required fields are marked *