Authored by 周少峰

301 redirect

@@ -12,8 +12,8 @@ module.exports = () => { @@ -12,8 +12,8 @@ module.exports = () => {
12 guangReg = /^\/guang/, 12 guangReg = /^\/guang/,
13 guangDetailReg = /.html$/; 13 guangDetailReg = /.html$/;
14 14
15 - if (req.subdomains.length > 1) {  
16 - res.redirect(helpers.urlFormat(req.path, req.query, req.subdomains[0])); 15 + if (req.subdomains.length > 1 && req.subdomains[1] === 'www') {
  16 + res.redirect(301, helpers.urlFormat(req.path, req.query, req.subdomains[0]));
17 } 17 }
18 if (req.subdomains.length) { 18 if (req.subdomains.length) {
19 switch (req.subdomains[0]) { 19 switch (req.subdomains[0]) {