Redirect 如何重写nginx基准国
如果用户来自法语:Redirect 如何重写nginx基准国,redirect,nginx,rewrite,Redirect,Nginx,Rewrite,如果用户来自法语: 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 。。。 越南也是如此。 我已经在example.conf文件中编写了一些代码,但它不起作用: server_name www.example.com; root /srv/www/
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
。。。
越南也是如此。
我已经在example.conf文件中编写了一些代码,但它不起作用:
server_name www.example.com;
root /srv/www/example.com;
if ($country ~* "(vi|fr)") {
rewrite ^(.*)$ http://example.com/$country$1 permanent;
break;
}
有人能帮我吗??谢谢。您可以使用或处理标题