Ok here it is. I was getting tired of removing all the spam from this site, and the other 200 sites, I administer.
I looked up all the ips in US, UK, and Canada from http://www.countryipblocks.net/.
I formatted (compressed) the 51,600+ lines to 184 lines. Haven’t benchmark tested the difference; I’m 100% sure less lines is better, i.e. compressed css.
Don’t forget to change the line to allow your local lan ip, i.e. allow from 192.168.100 to whatever your lan is
Also, I put remarks in the htaccess only for reference. You can remove it all if you want.
Anyways you can this htaccess from here. Unzip, Copy and paste into your root htaccess or rename htaccess to .htaccess and place in the root of your website
Good Luck.
Excerpt…..
# This htaccess will only allow United States, UK, and Canada. The rest of the world will get 403 "Access Denied/Forbidden"
# This goes into your root .htaccess
#
# Point 1. I left the remarks, i.e. Total Subnets: 1,532,309,752 so you can check http://www.countryipblocks.net for any new subnets periodically
# Point 2. I compressed approx. 51,600 lines, into 184 lines.
# Point 3. If your server responds with code 500 Internal Server Error, it means your web server can’t process these long lines.
## Solution1, is to make more line chunks so 184 lines would be 200 lines or more using the same method "allow from".
## Solution2 buy more ram.
## Solution3 adjust timeouts in Apache PHP, etc..
# Point 4. The internal lan section, is if the web server is on your internal lan.
# Point 5. Processing the htaccess may take additional time depending on your equipment.
# A test server took 2-3 seconds to process this 812 kb htaccess; XEN VM, two cores, 2gigs of ram.
#
# These ranges of IP Blocks, Segments, Subnets, Networks, Public IPS (Just Tags)
# were last updated on 2011-12-14 from http://www.countryipblocks.net/
# This htaccess wwas created by webdevster.com.
order deny,allow
# Custom: Internal Lan
allow from 192.168.100
# Country: UNITED STATES
# ISO Code: US
# Total Networks: 40,524
# Total Subnets: 1,532,309,752
allow from 3.0.0.0/8 4.0.0.0/8 6.0.0.0/8 7.0.0.0/8 8.0.0.0/8 9.0.0.0/8……………………………

















