Localising content with GeoIP and Apache


Today I came across a page on MaxMind's site which shows some of the things you can do using mod_geoip (the GeoIP Apache module). Using the GeoIP data in applications isn't rocket science anyway, but the Apache module allows you to do some fairly funky stuff all server-side. E.g. say you had a download site with a few mirrors in different parts of the world, you could automatically redirect users to the correct one with something like:

GeoIPEnable OnGeoIPDBFile /path/to/GeoIP.datRewriteEngine on
RewriteRule ^(.*)$ http://us-mirror.mydomain.com$1 [L]
RewriteRule ^(.*)$ http://uk-mirror.mydomain.com$1 [L]

and so on.

Comments (0) Tags: GeoIP, apache

Add Comment

(Never shown on the site)

(Newlines preserved, format with Markdown)