default.js
984 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
* Created by TaoHuang on 2017/2/22.
*/
'use strict';
const helpers = global.yoho.helpers;
const TYPE = require('../type');
module.exports = [
{
type: TYPE.redirect,
origin: /\/product\/sale\/\?channel=(.*)/,
target: (req, match, channel) => {
return helpers.urlFormat(`/product/${channel}-sale/`);
}
},
{
type: TYPE.redirect,
origin: '/product/sale/?msort=10',
target: helpers.urlFormat(`/product/lifestyle-sale/`)
},
{
type: TYPE.redirect,
origin: /\/about?shopId=([\d]+)/,
target: (req, match, id) => {
return helpers.urlFormat(`/shop${id}-about`, null, req.subdomains[0]);
}
},
{
type: TYPE.rewrite,
origin: /\/shop([\d]+)-about/,
target: (req, match, id) => {
req.query.domain = req.subdomains[0];
req.query.shopId = id;
return '/product/index/about';
}
}
];