【问题标题】:How to rewrite nginx base country如何重写nginx基础国家
【发布时间】:2015-05-26 00:35:03
【问题描述】:

如果用户来自法语:

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;
}

谁能帮帮我??谢谢。

【问题讨论】:

    标签: redirect nginx rewrite


    【解决方案1】:

    您可以使用ngx_http_geoip_module 或处理Accept Language 标头。

    【讨论】:

      猜你喜欢
      • 2012-01-11
      • 1970-01-01
      • 2023-02-10
      • 2016-12-14
      • 1970-01-01
      • 2012-06-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多