span.fullpost {display:inline;}

Pages

Custom Search

Nov 29, 2010

Block Countries From Your Proxy Site

Traffic to your proxy website from certain countries can overload the hosting server. Other times, certain countries simply do not generate enough revenue or ad clicks. Others have a particularly high rate of fraud. There may even be other reasons, depending on the situation. Blocking countries from accessing a proxy site is an issue that often comes up in the business. The most common seem to be China and Iran followed by Afghanistan. There are some who prefer not to add these restrictions, while others feel it is necessary.


There are two ways to achieve this. One is to install GeoIP on your server, or ask your host to install it for you if they do not already have it. The other way is to obtain a large list from Block a Country.


The GeoIP way on a Linux server. Place this code on your .htaccess file:


RewriteEngine on


SetEnvIf GEOIP_COUNTRY_CODE CN BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE IR BlockCountry
Deny from env=BlockCountry


This would block China and Iran. Notice the use of 2 character ISO 3166 codes. To add more entries, just create a new line. For example, if Taiwan (TW) were to be added, the end result would look like this:


RewriteEngine on


SetEnvIf GEOIP_COUNTRY_CODE CN BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE IR BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE TW BlockCountry
Deny from env=BlockCountry


If GeoIP is not an option:


Use Block a Country to generate a list of IPs to block. Copy and paste the list to your .htaccess file.


Get proxy hosting with GeoIP, free advertising resources and outsanding tech support.


 

No comments:

Post a Comment