How To Block The Entire Planet From Your Site II

All it takes is 7 simple lines of code in the .htaccess file in your site's root.  Here they are:

<IfModule mod_geoip.c>
  GeoIPEnable On
  Order deny,allow
  deny from all
  SetEnvIf GEOIP_COUNTRY_CODE US TargetLocation
  Allow from env=TargetLocation
</IfModule>

You must of course, first install Maxminds GeoIP api on your server. Download for free here: http://www.maxmind.com/download/geoip/api/c/

Then install the Apache module mod_geoip.  Download for free here: http://www.maxmind.com/download/geoip/api/mod_geoip2/

Then add those lines to the .htaccess file

Done.  All http requests from outside the US will be denied.  If you are on a shared server, forget it.  You need a VPS or dedicated to do this.  Being able to install whatever you want on your server is a wonderful thing.  It took about 10 minutes to install this on CentOS (No yum install, and I did have to instal zlib-devel [yum install zlib-devel] as a prerequisite).

My opinions expressed on this site, in no way represent those of Boonex or Boonex employees.
Quote · 24 Jan 2013
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.