It can also be tailored to work in the negative, allowing only those counties you specify, say if that's a much shorter list and thus blocking all those that aren't listed like a wildcard. You may have to search for what the character(s) are for that, but it might be the inclusion of the ! character, which I think is equal to NOT; meaning NOT Fail those country codes listed. We have a board that uses that method, so different boards have different needs.If your host is using Apache, you can try enabling country-code blocking in htaccess. This one works in the positive, matching countries, then Failing all matches. Remove all the two character country codes you don't want blocked. BR is Brazil.We use these in conjunction with the above mentioned BOT blocks and IP range blocks, for granularity.Code:
GeoIPEnable On<IfModule mod_geoip.c> GeoIPEnable On</IfModule><IfModule mod_geoip.c>RewriteEngine onRewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^(AE|AF|AG|AL|AM|AO|AR|AS|AT|AZ|BA|BB|BD|BH|BJ|BN|BO|BR|BS|BT|BW|BY|BZ|CD|CF|CG|CI|CK|CI|CM|CN|CO|CU|CV|CW|CX|CZ|DJ|DM|DO|DZ|EC|EE|EG|EH|ER|ET|FJ|FM|FR|GA|GD|GE|GF|GH|GI|GL|GM|GN|GP|GQ|GS|GT|GU|GW|GY|HK|HN|HT|ID|IL|IN|IO|IQ|IR|JM|JO|KE|KG|KH|KI|KM|KN|KP|KR|KW|KY|KZ|LA|LB|LC|LI|LK|LR|LT|LU|LV|LY|MA|MC|MD|ME|MG|MN|MK|ML|MM|MN|MO|MP|MQ|MR|MS|MT|MU|MV|MW|MX|MY|MZ|NA|NC|NE|NG|NI|NP|NR|NU|OM|PA|PE|PF|PG|PH|PK|PL|PM|PN|PR|PS|PW|PY|QA|RE|RO|RS|RU|RW|SA|SB|SD|SG|SI|SK|SL|SM|SN|SO|SR|SS|ST|SU|SV|SX|SY|SZ|TC|TD|TF|TG|TH|TJ|TK|TL|TM|TN|TO|TR|TT|TV|TW|TZ|UA|UG|UK|US|UY|UZ|VA|VC|VE|VG|VN|VU|WF|WS|YE|YT|ZM|ZW)$RewriteRule ^(.*)$ - [F]</IfModule>
Code:
<IfModule mod_geoip.c> GeoIPEnable On</IfModule><IfModule mod_geoip.c>RewriteEngine onRewriteCond %{ENV:GEOIP_COUNTRY_CODE} ! ^(UK|US)$RewriteRule ^(.*)$ - [F]</IfModule>
Statistics: Posted by SQLnovice — Thu Feb 20, 2025 7:24 am