0

If user come from French:

www.example.com -> www.example.com/fr
www.example.com/blog -> www.example.com/fr/blog
www.example.com/contact -> www.example.com/fr/contact

... Same with country VietNam. I have write some code on file example.conf but it not working:

server_name www.example.com;
root /srv/www/example.com;
if ($country ~* "(vi|fr)") {
  rewrite ^(.*)$ http://example.com/$country$1 permanent;
  break;
}

Anyone can help me ?? Thanks.

tantan
  • 1
  • 1

1 Answers1

0

You can use ngx_http_geoip_module or handle Accept Language header.

Community
  • 1
  • 1
nörbörnën
  • 101
  • 2
  • 5