码迷,mamicode.com
首页 > Web开发 > 详细

12 nginx URL 重写 ecshop案例

时间:2015-01-28 19:39:00      阅读:258      评论:0      收藏:0      [点我收藏+]

标签:

一:URL 重写 ecshop案例

Rewrite语法 Rewrite 正则表达式 定向后的位置 模式 Goods
-3.html ---->Goods.php?goods_id=3 goods-([\d]+)\.html ---> goods.php?goods_id =$1 location /ecshop { index index.php; rewrite goods-([\d]+)\.html$ /ecshop/goods.php?id=$1; rewrite article-([\d]+)\.html$ /ecshop/article.php?id=$1; rewrite category-(\d+)-b(\d+)\.html /ecshop/category.php?id=$1&brand=$2; rewrite category-(\d+)-b(\d+)-min(\d+)-max(\d+)-attr([\d\.]+)\.html /ecshop/category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5; rewrite category-(\d+)-b(\d+)-min(\d+)-max(\d+)-attr([\d+\.])-(\d+)-([^-]+)-([^-]+)\.html /ecshop/category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5&page=$6&sort=$7&order=$8; } 注意:用url重写时, 正则里如果有”{}”,正则要用双引号包起来

 

12 nginx URL 重写 ecshop案例

标签:

原文地址:http://www.cnblogs.com/hgj123/p/4256472.html

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