Authored by 周少峰

Merge branch 'feature/seoUrl'

... ... @@ -8,12 +8,14 @@ const cachePage = {
// 频道页
'/': 30 * SECOND,
'/woman': 30 * SECOND,
'/kids': 30 * SECOND,
'/lifestyle': 30 * SECOND,
'/woman/': 30 * SECOND,
'/girls/': 30 * SECOND,
'/kids/': 30 * SECOND,
'/lifestyle/': 30 * SECOND,
// 商品详情页
'/product/\\/pro_([\\d]+)_([\\d]+)\\/(.*)/': 30 * MINUTE,
//'/product/\\/pro_([\\d]+)_([\\d]+)\\/(.*)/': 30 * MINUTE,
'/product/\\/p([\\d]+)(.*)/': 30 * MINUTE,
// 逛
'/guang/': 1 * MINUTE,
... ...
... ... @@ -7,7 +7,7 @@ module.exports = () => {
let isMobile = /(nokia|iphone|android|ipad|motorola|^mot\-|softbank|foma|docomo|kddi|up\.browser|up\.link|htc|dopod|blazer|netfront|helio|hosin|huawei|novarra|CoolPad|webos|techfaith|palmsource|blackberry|alcatel|amoi|ktouch|nexian|samsung|^sam\-|s[cg]h|^lge|ericsson|philips|sagem|wellcom|bunjalloo|maui|symbian|smartphone|midp|wap|phone|windows ce|iemobile|^spice|^bird|^zte\-|longcos|pantech|gionee|^sie\-|portalmmm|jig\s browser|hiptop|^ucweb|^benq|haier|^lct|opera\s*mobi|opera\*mini|320x320|240x320|176x220)/i.test(req.get('user-agent')); // eslint-disable-line
if (isMobile) {
req.url = req.url.replace(/^\/p([\d]+).html(.*)/, '/product/pro_$1_1/1.html$2');
req.url = req.url.replace(/^\/product\/p([\d]+).html(.*)/, '/product/pro_$1_1/1.html$2');
return res.redirect(`//m.yohobuy.com${req.url}`);
}
... ...
... ... @@ -57,7 +57,7 @@ module.exports = () => {
} else if (url === '/guang/Index/editor') {
data.mobileRefer += `/author/index?id=${req.query.author_id}`;
}
} else if (proRegNew.text(url)) {
} else if (proRegNew.test(url)) {
data.mobileRefer = url.replace(proRegNew, `//${domain}/product/pro_$1_1/1.html$2`);
}
... ...