Authored by 周少峰

url rewrire

@@ -27,7 +27,7 @@ module.exports = [ @@ -27,7 +27,7 @@ module.exports = [
27 target: (req, match, p1) => helpers.urlFormat(`/p${p1}.html`, null, 'item') 27 target: (req, match, p1) => helpers.urlFormat(`/p${p1}.html`, null, 'item')
28 }, 28 },
29 29
30 - // 商品详情页链接 30 + // 商品详情页链接
31 { 31 {
32 type: TYPE.rewrite, 32 type: TYPE.rewrite,
33 origin: /^\/p([\d]+).html(.*)/, 33 origin: /^\/p([\d]+).html(.*)/,
@@ -35,5 +35,14 @@ module.exports = [ @@ -35,5 +35,14 @@ module.exports = [
35 req.mobileUrl = `${MOBILE_DOMAIN}/product/pro_${p1}_1/1.html${p2 ? p2 : ''}`; 35 req.mobileUrl = `${MOBILE_DOMAIN}/product/pro_${p1}_1/1.html${p2 ? p2 : ''}`;
36 return `/product${req.url}`; 36 return `/product${req.url}`;
37 } 37 }
  38 + },
  39 + // 商品详情页新链接
  40 + {
  41 + type: TYPE.rewrite,
  42 + origin: /^\/([\d]+).html(.*)/,
  43 + target: (req, match, p1, p2) => {
  44 + req.mobileUrl = `${MOBILE_DOMAIN}/product/${p1}.html${p2 ? p2 : ''}`;
  45 + return `/product${req.url}`;
  46 + }
38 } 47 }
39 ]; 48 ];