Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to identify the country & change the URL accordingly

we have three domains one for US, one for UK, and one for Canada. i want that my users should be automatically redirected to country specific URL no matter what domain they open.e.g. if the user is from US and he is opening example.co.uk then he/she should be redirected to example.com.

like image 380
Mishigen Avatar asked Nov 30 '25 23:11

Mishigen


2 Answers

You can try to identify the country by IP. For example see http://www.ip2location.com/ This will not cover everybody, but should be ok for most cases.

like image 66
Tarlog Avatar answered Dec 02 '25 15:12

Tarlog


There are two options: 1) Configure your web server with the MultiViews option to look for browser settings and show appropriate page. 2) Use mod_rewrite / .htaccess and redirect the user based on Accept-Language HTTP header.

For complete details, please see the answer here. Thanks.

like image 44
Aziz Shaikh Avatar answered Dec 02 '25 13:12

Aziz Shaikh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!