I have a website with language ES-ES and I am launching its version in a new country ES-MEX.
I want to redirect all visitors to main website to the site for their country, choosing the best option to avoid overloads (I understand that running even one more script would increase the page download for all my local visitors, so I´d prefer to avoid that)
Would you use htaccess or php?
And what kind of code?
Thanks in advance
I have a website with language ES-ES and I am launching its version in
Share
You need to set up the dns server that will serve the requests for your domain and provide different server addresses for DNS name requests originated from networks located in Mexico. The BIND DNS server feature that allows you to accomplish this is called view
Thus, you define a view that matches the clients in Mexico and then this view reports different address(es) for names in your domain while for the rest of the World you still report the original ones.
You need to analyse your server logs and find with whois service the locations of the networks you are getting the connections from.
The second option is to use the content negotiation module of the Apache httpd server in a way that the version negotiated for es_MX language of all pages at your original web server would return redirects to the other server.
Both methods are not 100% reliable so clients from Mexico may get connected to your original server and I think that you should use both solutions simultaneously