首页 > 其他 > 详细

nginx $document_uri 参数使用

时间:2015-11-21 13:07:51      阅读:1021      评论:0      收藏:0      [点我收藏+]

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

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

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

nginx $document_uri 参数使用

原文:http://www.cnblogs.com/the-study-of-linux/p/4983288.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!