How to block visitors from specific countries

Emily Routledge

Member
Registered
Joined
Aug 13, 2016
Messages
61
Points
8
Due to low quality traffic and spammers coming my blog sites, I want to block visitors from specific countries. Where & how can I do that? please guide me in easy ways.

Your helps would be appreciated.
Emily
 

Optimidia

Member
Registered
Joined
Oct 5, 2016
Messages
42
Points
8
Blocking countries from visiting your website is as easy as modifying your .htaccess file. You will need to find the IPs from the countries or use some of those free services which will provide you a list of IPs from certain countries such as ip2location. Then you will have to use the following format to deny all those IPs per line.

Code:
<Limit GET HEAD POST>
order allow,deny
allow from all
deny from IP
deny from IP2
deny from IP3
</Limit>
 

RDO Servers

Well-known member
Registered
Joined
Apr 3, 2015
Messages
1,027
Points
83
Incapsula has this functionality built into their 'Web Application Firewall', although I believe it does require a paid service.
 

UWH-David

Member
Registered
Joined
Jan 18, 2016
Messages
45
Points
8

webhoster

New member
Registered
Joined
Jul 23, 2016
Messages
8
Points
0
Hello Emily,

If you are using cPanel, you can use the IP blocker to block IP addresses which are low quality and spammers.

Unfortunately, blocking a country is not easy in cPanel.

If you want to block a whole country in cPanel, you will need to do some hard work. You can check the list of IP addresses for a country here

http://www.nirsoft.net/countryip/

and then enter each as a range in cpanel IP Blocker.
192.168.0.1-192.168.0.40

This will block all visitors from that country.
 

Little Alien

Member
Registered
Joined
Jul 4, 2016
Messages
38
Points
0
Blocking countries from visiting your website is as easy as modifying your .htaccess file. You will need to find the IPs from the countries or use some of those free services which will provide you a list of IPs from certain countries such as ip2location. Then you will have to use the following format to deny all those IPs per line.

Code:
<Limit GET HEAD POST>
order allow,deny
allow from all
deny from IP
deny from IP2
deny from IP3
</Limit>
It's basic tips I would keep and use this on my site.

Create an .htaccess with the following http://www.ip2location.com/blockvisitorsbycountry.aspx and add the countries you wish to block.

If you have access to the VPS or server at root, this is cake. Install ConfigServer Firewall and use the country block section.
Nice share, I would go with this way but if I block IP ranges from my country but except my IP address then how to do that? How to check it blocked right IP address you wanted as in the list?

It can be a little trick for this but I would ask that, sorry for my question :D
 

EpicGlobalWeb

Well-known member
Registered
Joined
Jan 24, 2016
Messages
180
Points
0
In some instances, say if you want to block access from one specific user, you can stop them from not only accessing your website, but others' as well and my method is more fun than just a regular IP block. To do this you will need their permission. Yeah, that's right, permission. Written and signed >:D

Step 1: Open Notepad

Step 2: Save as a .bat file and give it a name

Step 3: Type ping their.ip.address.255 or URL -t -l # of packets

Example: ping www.google.com -t -l 50000
Example 2: ping 197.1.1.xxx -t -l 45000

Save the file again.

Make a copy (or two) of the file and change the packet amounts to random numbers (more than 15,000 for best results).

Most standard DDoS protections will look for a way to stop a lot of recurring junk packets, and will probably block packets of 50,000 when they come in huge volumes.

The solution is to keep changing the amount of packets. You can also change your IP and use a VPN to attack your attacker (you know, if they agree to it - and only if they agree to it, for security penetration testing reasons).

There is virtually no defense against this.
 
Recommended Threads

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top