Last active
July 26, 2017 20:26
-
-
Save steveosoule/1a8dcddaf0b3b86b45a74d5a8a8fee4a to your computer and use it in GitHub Desktop.
MaxMind GeoIP Database .htaccess Cookie & HTTP Variable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment