I've got a site that needs to have at least two almost identical versions for two different countries/languages, and visitors should access one or the other depending on their location, country or language (in fact, the best answer in my case would be redirect by country).

The webserver is Apache, and I've read something about the GeoIP Apache API, but I'm not sure how to apply it (some brief instructions would be much appreciated) to my Apache install, and from there how to redirect one version or the other depending on the visitor location (that as far as I know is guessed through visitor's IP).

I wonder if maybe the language of the browser could be of use here, and redirect to each versions depending on the language code (en_US, es_ES, etc).

Is there a solution to this (if possible, free, but commercial solutions would be considered as well)?

link|improve this question

77% accept rate
1  
You seem confused as to how you want to redirect users: Pick one Country/Location or Language. For Country/Location: Have you looked at the examples on the mod_geoip page you linked to? If Language: Browsers already send an Accepted-Language header with the language codes. After you figure the above out, please feel free to ask specific questions about implementing these. To answer your question "Is there a good answer" - Yes, there is; but you have to ask a good question first. – Chris S Jan 25 at 14:52
feedback

2 Answers

up vote 5 down vote accepted

Do what international shipping companies do and have a "select your country" thing on the front page. Use the browser field to determine the default language. Use geo_ip to determine the default country. Make the user confirm, make sure they can change it, and make sure you store it in a cookie so they don't have to do it again.

link|improve this answer
Understood, thanks! – javipas Jan 25 at 15:36
feedback

The site you link has all the relevant information on configuring apache with mod_geoip (which you should install beforehand).

Redirection by browser language is also covered in the httpd.conf comments as well as in a bazillion google hits, like this, for instance.

All this should solve your problem. If not, state why. Cheers.

link|improve this answer
Thank you too, Alien Life Form (nice username, btw) :) – javipas Jan 25 at 15:36
feedback

Your Answer

 
or
required, but never shown

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