| cerulean |
11-24-2025 11:30 AM |
You can do this with the MaxMind Apache module, and either Vacares or MojoHost can set this up for you no problem.
In the VirtualHost they'll setup mod_maxminddb, and set the MaxMindDBEnv for GEOIP_REGION_CODE and GEOIP_COUNTRY_CODE.
The code in the htaccess looks similar to this:
Code:
RewriteCond %{ENV:GEOIP_REGION_CODE} ^(TWO_LETTER_COUNTRY_CODES|CN|ETC)$
RewriteCond %{ENV:GEOIP_REGION_CODE} ^(TWO_LETTER_STATE_CODES|TX|ETC)$
RewriteRule ^(.*)$ blocked/index.php [L]
You will also want to expose certain things to these states/countries, depending on their use, such as whether they are a bot trying to crawl pages:
Code:
RewriteCond %{HTTP_USER_AGENT} !^.*(BOTS|GO|HERE).*$
You might also want to expose logos or scripts or other non-explicit content for your blocked page.
LoginBlue offers directory protection with MaxMind database integration (working on API integration), if you're looking to just protect your members area. It also supports AVS integration.
|