nginx配置url伪静态
- rewrite 规则 定向路径 重写类型;
 - 举例: rewrite (.*)/web/(.*)-(.*)-(.*).html$ $1/web/index.php?r=$2/$3/$4 last; 浏览器中输入http://test.com/web/api-test-index.html 会被nginx转化为http://test.com/web/index.php?r=api/test/index去请求服务器资源。
 - rewrite 后面的规则 (.*)/web/(.*)-(.*)-(.*).html$ 是匹配请求的路径的(即浏览器中输入的url),定向路径 $1/web/index.php?r=$2/$3/$4 是指服务器上的项目真实的路径,重写类型有多个,last,break,redirect,permanent,具体看nginx文档或戳这里
 - ()中匹配到的内容会被按顺序分配到变量$1 $2 $3 $4中,上面的正常来说就是$1匹配的是域名, $2匹配moduleID(这里是以yii的路由来说的),$3匹配controllerID, $4匹配actionID
 - 参考:https://blog.csdn.net/qq_25600055/article/details/78543614
 
相关推荐
  Nicolase    2020-01-04  
   liudaniel    2019-11-19  
   Garfier    2008-05-12  
   成人用品    2019-10-29  
   crazyjingling    2011-05-18  
   iPro    2011-05-05  
   liwf    2019-05-18  
   CSDNMrWang    2012-09-26  
   一味    2019-07-01  
   iamlihongwei    2012-03-22  
   maxintcsdnblog    2019-06-27  
   feier0    2013-08-20  
   liudaniel    2013-03-09  
   xiaocao    2013-01-04  
   ithover    2012-10-23  
   清风落叶    2012-09-25  
   fightingtl    2012-10-17