Block Australian visitors from your website until their laws improve.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
938 B

# 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
<Location "/">
<If "env('BlockCountry') == '1'">
RewriteEngine On
RewriteCond %{REQUEST_URI} !/block\-au\.php$ [NC]
RewriteRule "^(.*)$" "https://domain.com/block-au.php" [L,R=302]
</If>
</Location>