Skip to content

Instantly share code, notes, and snippets.

@steveosoule
Last active July 26, 2017 20:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steveosoule/1a8dcddaf0b3b86b45a74d5a8a8fee4a to your computer and use it in GitHub Desktop.
Save steveosoule/1a8dcddaf0b3b86b45a74d5a8a8fee4a to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment