3

I have a web site. It is designed for two target groups of users: one from Eastern Europe, second - from USA. I also have two hosting accounts - one in USA and one in Europe.

I'd like to route the traffic in such a way that visitors from USA are pointed to hosting server in USA, while visitors from Europe are pionted to server in Europe. Is it possible to configure my DNS server (or whatever...) and how can it be done?

0
3

The cheapest way to accomplish this would be to setup a sub-domain for each.

eu.yoursite.com and us.yoursite.com

Then when they first arrive on yoursite.com you can use a tool to determine their geolocation based on IP such as: http://www.ip2location.com/ or http://dev.maxmind.com/geoip/geolite

Set a cookie to direct them to the most appropriate subdomain.

Also html5 has a geolocation api.

3

You can do this with DNS if you use a service such as Route53: DNS GeoProximity Trafic Routing

If you wanted to setup your own DNS server to do this kind of thing you could look into technologies such as GeoDNS with BIND.

A different approach would be to use load balancing software such as HAProxy to geolocate the user, and then pass the traffic to your desired server: GeoIP with HAProxy

With the HAProxy approach, you would update your DNS to send all traffic to your HAProxy server, and then it would route traffic to and from the appropriate regional backend server. This might not be as efficient as you'd hope because your HAProxy server is not necessarily going to be in the same geographical region as your user.

1

Redirecting Visitors Based on Country Location in Apache2

This can be done easy in Apache2 by installing the Mod_geoip2 Apache Module, basically it connects to various API based GEO database providers and detect where the visitor is located, you can then use this collected data to redirect. A simple example of the .htaccess file would look like:

GeoIPEnable On
GeoIPDBFile /path/to/GeoIP.dat

# Redirect EU
RewriteEngine on
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^EU$
RewriteRule ^(.*)$ http://www.EU-Site.com$1 [R,L]

# Redirect Asia, North America and South America
RewriteEngine on
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^(NA|SA|AP)$
RewriteRule ^(.*)$ http://www.US-Site.com$1 [R,L]

As you can see this is a fairly easy task but your need to pay for up to date DATABASES and normally these are charged per X amount of requests. For the module it can be found here: mod_geoip2

1

IP geolocation technology is right for you. It detects visitors locations based on their IPs. There are tools available redirect visitors to location-specific URLs accordingly based on locations(like countries) they are visiting from. You can set up redirecting rules for individual markets, associated with separate links.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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