});
/* LMNO middleware to lookup the game. */
-app.use('/empires/:game_id([a-zA-Z0-9]{4})', (request, response, next) => {
+app.use('/:engine([^/]+)/:game_id([a-zA-Z0-9]{4})', (request, response, next) => {
+ const engine = request.params.engine;
const game_id = request.params.game_id;
const canon_id = lmno_canonize(game_id);
/* Redirect user to page with the canonical ID in it. */
if (game_id !== canon_id) {
- const new_url = request.originalUrl.replace("/empires/" + game_id,
- "/empires/" + canon_id);
+ const new_url = request.originalUrl.replace(`/${engine}/${game_id}`,
+ `/${engine}/${canon_id}`);
response.redirect(301, new_url);
return;
}