Skip to content

Commit

Permalink
correct domain
Browse files Browse the repository at this point in the history
  • Loading branch information
rosano committed Feb 28, 2024
1 parent 3ed596d commit 52bf5d6
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,21 @@ app.use(function removeWWW (req, res, next) {
return res.redirect(301, 'https://' + req.headers.host.slice(4) + req.originalUrl);
});

app.use(function correctDomain (req, res, next) {
const map = {
'oott.rosano.ca': 'archive.rosano.ca',
'refs.rosano.ca': 'ref.rosano.ca',
'rcreativ.com': 'rosano.ca',
'phileplanet.com': 'rosano.ca',
'list.rosano.ca': 'utopia.rosano.ca',
};

if (!Object.keys(map).includes(req.get('host'))) {
return next();
}

return res.redirect(301, 'https://' + map[req.get('host')] + req.originalUrl);
});


app.listen(process.env.PORT);

0 comments on commit 52bf5d6

Please sign in to comment.