Localising content with GeoIP and Apache

Posted 17:13, 24/5/2007, in Web

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
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^US$
RewriteRule ^(.*)$ http://us-mirror.mydomain.com$1 [L]
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^GB$
RewriteRule ^(.*)$ http://uk-mirror.mydomain.com$1 [L]

and so on.

Add comment

Or login with OpenID

Search this site
Login
(or login/signup the old fashioned way)
Elsewhere

External URLs/articles that may be of interest:

PHP - Architecture, Scalability, and Security

Slides from Rasmus' OSCON talk, once again some interesting ways of tweaking server performance to get the most out of PHP apps.

New Rails documentation site

Lack of a decent manual has always been a big problem for Rails (an API reference is not a manual!) A number of projects have sprung up in the last year or so trying to make up for this, this new one is the best I've seen so far, so hopefully it will gain some traction.

bbc.co.uk moving to Zend Framework

The BBC are updating their perl/SSI based backend to a platform using Java for the backend and Zend Framework for the frontend.

Stock image search engine

Free text search for a number of different stock photo sites, results include thumbnails, dimensions and license info. The advanced search option allows you to, among other things, restrict results to only photos with a particular license (e.g. "public domain").