简体   繁体   中英

Detect country from ip and redirect to according country

I want to redirect the website according to detect country from IP address and redirect it to according country. ex. http://www.test.com/in/contact , http://www.test.com/us/contact . How do I achieve that in laravel ?

Look at this post How to detect language preference in Laravel 5
you can get the language form the header with the code below and redirect accordingly

Request::server('HTTP_ACCEPT_LANGUAGE')

// OR

$request->server('HTTP_ACCEPT_LANGUAGE');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM