Here, We have learned how to block specific country traffic/ip/requests. We have seen in our access logs that lots of unwanted traffic is coming up on domain, so it’s just affecting our bandwidth and our site is getting down & and it’s affecting the reputation & harm of the site. So, in this article we looked at how to block the suspicious request.
How we can check out the traffic ?
In this article I’m using “Cloudflare free services”. Here you can check out the traffic by countries / regions wise
If you are in “cpanel” then you can choose awstats and it becomes visible as countries wise
If you are in hpanel then use the “access logs” and it becomes visible as countries wise
How to create Specific IP Blocks?
So, go to the Country Ip block, If the link does not work then you should used proxy to opening it.
Select the country that you want to block then select the format, for this article i’m using apache server and i want to block the ip’s, So i’m selected “Apache .htaccess Deny” otherwise if your allowing the specific country then you just selecting the “Allow” options instead of “Deny”.
And Now click on “Create ACL” and Now it’s generated into ACL Results after that click on “Copy ACL to Clipboard”.
Insert ACL into .htaccess
Now, move to our hosting panel and go to the “.htaccess” file, if the file is not shown there then you can enable the hidden files options and it becomes visible, Now you can paste it at bottom.
1 In hpanel Go to Files > File Manager > public_html > .htaccess
2 In cpanel Goto File Manager > public_html > .htaccess
3 – In ftp Go to public_hmtl >.htaccess and edit as editor and save on to it.