Blocking IP address from your website or using cpanel can be done easily. Today we learn how to block Ip address from website as well as htaccess ip block. Before we get into blocking ip address, we shall discuss few important points to block Ip address.
You guys know well that wordpress blogs are hacked easily when compared to other platforms. Securing wordpress sites from hackers, staying safe in protecting our content and files is must. So, I was checking my gmail inbox and found a suspicious activity. A user with IP address xxx.xxx.xx.xx tried to hack my wordpress site with username admin and bloggerbulk. As per wordpress security tips concerned, using admin as username is really a bad idea. This is what that guy thought to hack my site. So always change your default username from “admin”. Now after finding which IP address is trying to hack your site..? Then we should block that Ip for our safety.
Inorder to block Ip address, I would list two methods first from cpanel and the other htaccess method. So let’s get into tutorial.
Block IP Address with Cpanel
I am using Hostgator now, if you are using bluehost or any other, almost the process is same. Log into your cpanel, under security section, click on IP Deny Manager, in next window you get option to enter Ip address for blocking.
Now, enter your victims IP you traced for suspicious activity and then click on add. You are done in blocking IP address.
Htaccess Ip Block
If you are looking for htaccess ip block method for blocking ip address, then look at below example code that should be added in your .htaccess file
deny from 255.255.0.0
deny from 188.8.131.52
allow from all
The above is clear and almost you can understand. If not, here I go..
Deny from 255.255.0.0 : This ip (255.255.0.0 ) will be blocked to view your site.
Deny from 184.108.40.206 : This Ip ( 220.127.116.11.0 ) will be blocked to view your site.
Allow from all : The rest of IP’s are allowed.
Now if you are looking to block all ip address except your, then look at below code
allow from 18.104.22.168
deny from all
The above code should be added in your htaccess file and clear explaining, only the IP 22.214.171.124 would be able to access site and the rest of IP would be blocked. Note: You need to replace this with your IP address. “Deny from all” code will block all other IP’s except 126.96.36.199. So if you found this tutorial helpful so comment and share it social media.