首页 > 代码库 > 12 nginx URL 重写 ecshop案例
12 nginx URL 重写 ecshop案例
一:URL 重写 ecshop案例
Rewrite语法Rewrite 正则表达式 定向后的位置 模式Goods-3.html ---->Goods.php?goods_id=3goods-([\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案例
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。