【发布时间】:2018-10-04 09:33:49
【问题描述】:
我们正在部署一个使用不同 TLD 的国际网站。
我们使用来自 nginx 的 ipgeo 模块来检测用户位置,并在需要时进行重定向。
但我们发现机器人存在一些问题,因此我们希望在这种情况下防止重定向。
为此,我们需要在 nginx 配置中使用双重条件,但不支持。
我们可以使用不同的解决方案吗?谢谢
这是来自英国配置的代码 sn-p,我认为这是不言自明的。
if ($http_user_agent !~* "google|yahoo|bingbot|baiduspider|yandex|yeti|yodaobot|gigabot|ia_archiver|facebookexternalhit|twitterbot") { # 转到全球站点 如果($geoip_city_continent_code!=“欧盟”){ 重写 ^ https://xxxx.us$request_uri 永久; } # 转到欧盟网站 如果 ($geoip_city_country_code != "GB") { 重写 ^ https://xxxx.eu$request_uri 永久; } # 留在英国网站 }【问题讨论】:
标签: nginx ip-geolocation