Emanegux
Emanegux

Reputation: 1120

Simplest Way to Block an Entire Country from Accessing Server

I've been getting spammed pretty hard in the last two weeks and started looking up the IP's of the spammers and noticed that they were all from very specific countries that my website isn't even interested in. I found a solution online to this problem, but it involves putting a large amount of code into htaccess for blocking the IPs. Is there a minimal approach to blocking entire countries? I'm also wondering if there is some kind of geographical representation of the range of IPs over a map so the next time I can have a visual aid for pinpointing where the spam is coming from.

Upvotes: 0

Views: 1572

Answers (1)

Codehead
Codehead

Reputation: 126

GeoIP provides country code information in the free Database. I tweaked a phpBB forum to use it and saw a big reduction in junk.

However, blocking China, India, Vietnam and the other bad places will only work as long as the spammers don't use proxies. Also, some IPs from those areas resolve to 'Unknown' and you will probably have to let those through or risk blocking legit users.

Upvotes: 1

Related Questions