steveosoule
7/17/2017 - 11:29 PM

MaxMind GeoIP Database .htaccess Cookie & HTTP Variable

MaxMind GeoIP Database .htaccess Cookie & HTTP Variable

.htaccess to set MM_Country_Code HTTP Header or Cookie
=====================================================

### Begin - MaxMind Country Detection
MaxMindDBEnable On
MaxMindDBFile DB /var/www/vhosts/example.com/private/GeoIP2-Country.mmdb
MaxMindDBEnv MM_COUNTRY_CODE DB/country/iso_code

Header add X-MM-Country-Code "%{MM_COUNTRY_CODE}e"
RequestHeader set X-MM-Country-Code "%{MM_COUNTRY_CODE}e"
Header set Set-Cookie "MM_COUNTRY_CODE=%{MM_COUNTRY_CODE}e;path=/"
### End - MaxMind Country Detection


# Creates:
# s.http_x_mm_country_code
# g.request_cookies:mm_country_code