# Installing: # 1. Place in /etc/apache2/conf-available/block-au.conf # 2. Place block-au.php in your webroot # 3. Replace domain.com below with your domain # 4. Download the GeoLite2 Country database from https://dev.maxmind.com/geoip/geoip2/geolite2/ and place it in /usr/local/share/GeoIP # 5. Install the MaxMindDB Apache module from https://maxmind.github.io/mod_maxminddb/ # 6. Run `a2enconf block-au` # 7. Restart Apache # 8. Australian visitors will now be redirected to the block message. MaxMindDBEnable On MaxMindDBFile DB /usr/local/share/GeoIP/GeoLite2-Country.mmdb MaxMindDBEnv MM_COUNTRY_CODE DB/country/iso_code SetEnvIf MM_COUNTRY_CODE ^(AU) BlockCountry RewriteEngine On RewriteCond %{REQUEST_URI} !/block\-au\.php$ [NC] RewriteRule "^(.*)$" "https://domain.com/block-au.php" [L,R=302]