码迷,mamicode.com
首页 > 其他好文 > 详细

nginx $document_uri 参数使用

时间:2015-06-09 17:46:11      阅读:1337      评论:0      收藏:0      [点我收藏+]

标签:permanent   配置文件   

$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 参数使用

标签:permanent   配置文件   

原文地址:http://881955.blog.51cto.com/871955/1660048

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!