I am working with Laravel 5.4 and simple JS and jQuery to achieve this.
I have a website from a small investment group who is active in Belgium and Holland. Two small neighbour countries. They have a few legal items on the website that differ in Belgium and Holland. When you navigate to the website, there is a JS check to determine if you are in Holland of Belgium.
$.getJSON("https://ipinfo.io",
function (data) {
$myLocation = data.country;
}
);
if ($myLocation == 'BE') {
window.location.href = $baseurl + '/BE';
} else if ($myLocation === 'NL') {
window.location.href = $baseurl + '/NL';
}
After I get the country from this website https://ipinfo.io
I simply redirect to the baseurl + a parameter specifiek to the country. The copy is simply loaded via the Laravel standard locale and language files.
--
Problem is, I have tested this with a proxy (since I am currently in Belgium, not Holland) to see if the correct redirect is active and the correct copy is loaded. This all seems to work, but my client (who is actually in Holland) keeps getting redirected to the wrong locale.
Thanks for any input on this.