diff --git a/package.json b/package.json index 1aaee3593..74bdeaca8 100644 --- a/package.json +++ b/package.json @@ -119,6 +119,7 @@ "es6-object-assign": "^1.1.0", "es6-promise-polyfill": "^1.2.0", "express": "^4.13.3", + "express-naked-redirect": "^0.1.2", "express-static-gzip": "^0.2.2", "leaflet": "^1.2.0", "leaflet-image": "^0.4.0", diff --git a/server.js b/server.js index b13ba8bb0..da785b993 100644 --- a/server.js +++ b/server.js @@ -68,6 +68,11 @@ if (devServer) { app.use('/dist', express.static('dist')); // why is this line here? } +/* redirect www.nextstrain.org to nextstrain.org */ +app.use(require('express-naked-redirect')({ + reverse: true +})); + /* loader.io token (needed to run tests) */ app.get("/loaderio-b65b3d7f32a7febf80e8e05678347cb3.txt", (req, res) => { res.sendFile(path.join(__dirname, "loader.io-token.txt"));