I'm about to redirect my French users from mysite.com to mysite.fr. Is it possible using DNS CNAME records or should I write some GEOLocation codes to do that?
I will appreciate any other ideas.
I have never tried to use a DN-Server for redirecting according to user location.
Important questions to be asked:
Do we talk about country-specific contents or language-specific contents?
Do you have two different sites - and you want to redirect users, that access a computer on french territory and type "mysite.com" to "mysite.fr"? Or do we talk about one big system with country(or language?)-specific views?
Further: Whatever redirection-mechanism you apply, give your users the possibility to go elsewhere, in case your redirection was based on false assumptions! It is very bad UI, if your users are eventually bound to a french interface, just because they sit in hilton in paris, and might not even speak french!
Lets look on two possibilities, based on the assumption, that we talk about one big system:
a) If your site is, e.g., an e-commerce site, and you want your customers living in france to visit the french-section! - than it is obvious, that you need to lookup their actual location - e.g. based on the IP. That means, that you are not necessarily redirecting french users, but users living in France. That is the right solution, if your site is specific for the different locations, such as France, USA, Germany or whatever.
b) If it is merely for language-reasons, than you might want to know the preferred language of the actual user, and redirect him/her to that version of your site, that shows the content in the language, that the user prefers. Now you are redirecting users, that e.g. use a french language settings on their computer, which indicates their language preference. With this, you will redirect users from all french speaking countries and users, that have french browser settings, but live in different countries, to your french site. That is good, if your content is not location specific but translated in different languages.
That said, there are solutions for both problems.
For Problem A, you want to lookup the IP of the site visitor, and based on the location of that IP redirect the user. Most CMS Systems will have modules for that purpose: http://drupal.org/project/smart_ip/ together with http://drupal.org/project/ip2locale. You might want to look into their code, if you develop your own system. You should find this kind of module for all relevant systems.
For Problem B, you want to lookup browser settings. This kind of language negotiation should be part of any multi-lingual CMS System...
I would also look at implementations, used by apple or other big international sites: They have a .com site for all countries, but redirect user, that try to visit .de to their country-specific location. Then they arrive at apple.com/de/ - which I think is a good solution. In this case I would just redirect all direct visits via a country-specific url to the country section (.fr-com/fr) which might also happen at server level - and not at system level - while all visitors to .com will be redirected to the section based on their IP or their browser language. With all of that, a good language or country navigation (that remembers based on cookies e.g.) is mandatory - so that users, that are mistakenly taken to the wrong place can find their way...
Now, if you have two different sites, and want to redirect users so to speak to a location outside of the current site, they are visiting, that would be a bit different. Let us know, than we can think about solutions for that scenario.