Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So I need to set a VirtualHost that have one domain to route clients to different applications depending on their IP address.

For example I want an american user that visits to be served from /path/to/usa/application while users from different countries should be served from /new/international/application/path

share|improve this question
up vote 4 down vote accepted

You can do this with mod_geoip and mod_rewrite. Something like the following should do the trick:

DocumentRoot /new/international/application/path

GeoIPEnable On
GeoIPDBFile path-to-geoip.dat

RewriteEngine On
RewriteRule ^(.*)$ /path/to/usa/application/$1 [L]

Requests from an IP address which the geoip module classifies as being in the US will be served from /path/to/usa/application, whereas other requests will be served from the default document root.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.