$document_uri 表示访问的url
现在我的需求是,访问 www.xxx.com 请求到 www.xxx.com/bbs/
在nginx配置文件中加入

if ($document_uri !~ ‘bbs’)
{
rewrite ^/(.*)$ http://www.xxx.com/bbs/$1 permanent;
}

而不是单独加一句 rewrite ^/(.*)$ http://www.xxx.com/bbs/$1 permanent;
如果只加rewrite 规则,而不限定条件,那么会造成死循环。 会访问到 http://www.xxx.com/bbs/bbs/bbs/bbs/…

相关文章:

  • 2021-06-27
  • 2022-01-18
  • 2021-12-09
  • 2022-12-23
  • 2021-09-12
猜你喜欢
  • 2022-03-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2023-03-28
  • 2022-12-23
相关资源
相似解决方案