Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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)?

share|improve this question
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 '12 at 14:52
add comment

3 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.

share|improve this answer
    
Understood, thanks! –  javipas Jan 25 '12 at 15:36
add comment

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.

share|improve this answer
    
Thank you too, Alien Life Form (nice username, btw) :) –  javipas Jan 25 '12 at 15:36
add comment

You could use a hosted solution as well (like the one I'm involved in: www.splitterhq.com) especially for marketing links and QR Codes.

Then you can remove the step where users have to select the country and link to specific subpages or social media profiles etc.

All the best

share|improve this answer
add comment

protected by Michael Hampton Mar 25 at 2:45

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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