ECMall2.1在nginx下的rewrite

2016-07-07 16:49 来源:www.chinab4c.com 作者:ecshop专家

根据自己的需求写了nginx下的ECMall的rewrite,分享给大家!希望对大家有帮助
  1. location / {

  2. rewrite "^/index.html$" /index.php last;

  3. #商品详情
  4. rewrite "^/goods/([0-9]+)\.html$" /index.php?app=goods&id=$1 last;
  5. rewrite "^/goods/([0-9]+)/([^//]+)\.html$" /index.php?app=goods&id=$1&act=$2 last;
  6. rewrite "^/goods/([0-9]+)/([^//]+)/page_([^//]+)\.html$" /index.php?app=goods&id=$1&act=$2&page=$3 last;
  7. rewrite "^/groupbuy/([0-9]+)\.html$" /index.php?app=groupbuy&id=$1 last;

  8. #分类
  9. rewrite "^/category/goods\.html$" /index.php?app=category last;
  10. rewrite "^/category/(.*)\.html$" /index.php?app=category&act=$1 last;

  11. #品牌
  12. rewrite "^/brand\.html$" /index.php?app=brand last;

  13. #文章
  14. rewrite "^/article/([0-9]+).html$" /index.php?app=article&act=view&article_id=$1 last;

  15. #店铺页面
  16. rewrite "^/store/([0-9]+)\.html$" /index.php?app=store&id=$1 last;
  17. rewrite "^/store/article/([0-9]+).html$" /index.php?app=store&act=article&id=$1 last;
  18. rewrite "^/store/([0-9]+)/credit\.html$" /index.php?app=store&id=$1&act=credit last;
  19. rewrite "^/store/([0-9]+)/credit/page_([^//]+)\.html$" /index.php?app=store&id=$1&act=credit&page=$2 last;
  20. rewrite "^/store/([0-9]+)/credit/([0-9]+)\.html$" /index.php?app=store&id=$1&act=credit&eval=$2 last;
  21. rewrite "^/store/([0-9]+)/credit/([0-9]+)/page_([^//]+)\.html$" /index.php?app=store&id=$1&act=credit&eval=$2&page=$3 last;
  22. rewrite "^/store/([0-9]+)/goods\.html$" /index.php?app=store&id=$1&act=search last;
  23. rewrite "^/store/([0-9]+)/goods/page_([^//]+)\.html$" /index.php?app=store&id=$1&act=search&page=$2 last;
  24. rewrite "^/store/([0-9]+)/category/([0-9]+)\.html$" /index.php?app=store&id=$1&act=search&cate_id=$2 last;
  25. rewrite "^/store/([0-9]+)/category/([0-9]+)/page_([^//]+)\.html$" /index.php?app=store&id=$1&act=search&cate_id=$2&page=$3 last;
  26. rewrite "^/store/([0-9]+)/groupbuy\.html$" /index.php?app=store&id=$1&act=groupbuy last;
  27. rewrite "^/store/([0-9]+)/groupbuy/page_([^//]+)\.html$" /index.php?app=store&id=$1&act=groupbuy&page=$2 last;

  28. }
复制代码


回答:
我没有用过 nginx ,不过精神值得表扬

这个不能用

用了之后地址结尾没有。html