Authored by 李靖

301

... ... @@ -37,3 +37,11 @@ exports.index = (req, res, next) => {
}, goodsList));
})().catch(next);
};
// 301到新路由
exports.redirect = (req, res) => {
let redirectUrl = '/mip/chanpin/';
redirectUrl += `${req.params.id}.html`;
res.redirect(301, redirectUrl);
};
... ...
... ... @@ -20,5 +20,6 @@ router.get(/^\/guang\/info\/(.*?)\.html/, rewrite.resolve, guang.detailIndex);
router.get(/^\/guang\/(.*?)\.html/, rewrite.resolve, guang.detailIndex);
router.get('/chanpin/:id.html', chanpin.index);
router.get('/list/:id.html', chanpin.redirect);
module.exports = router;
... ...