I need to block country. Just i have spam from South Africa (48%). How to block users and robots with .htaccess? please help. Thank you in advance
Have some one question. This country have many ip addresses example 3000 - one per line? This mean very big .htaccess file. Do you have a problem for web server file size of .htaccess - example .htaccess size is 30 kb Thank you again
You are probably much better off just blocking the IP addresses that send you spam rather than all IP addresses from that country. If the IP addresses change a lot and you don't see the same one twice then maybe try blocking the ISP rather than the whole country. A whois search on the IP address will tell you the whole range owned by that ISP. The .htaccess file you get from www.blockacountry.com uses CIDR notation to specify a range of IP addresses, often up to 65,536 of them on a single line. This is far more efficient than one IP address per line. Still, they have been less efficient than they could have been. For instance, when blocking Australia they have blocked nearly the entire 203.19.0.0/16 range (65,536 IP addresses) in around 120 lines of /23 (512 IP addresses) and /24 (256 IP addresses) even though the entire /16 range is Australian and could have been blocked in a single line. (Not that you would want to block Australia...) You could probably tidy up their list quite a lot to make the file size smaller. Still, I think you would be better off blocking the spamming IP addresses only and not the whole country. Good luck.
Check in geoip which country range that you want to block. Then just issue the command to block a range of IP address and you are on your way.