diff --git a/core/server/admin/middleware.js b/core/server/admin/middleware.js index 8485436c9d..d12673dc78 100644 --- a/core/server/admin/middleware.js +++ b/core/server/admin/middleware.js @@ -1,7 +1,10 @@ var utils = require('../utils'); function redirectAdminUrls(req, res, next) { - var ghostPathMatch = req.originalUrl.match(/^\/ghost\/(.+)$/); + var subdir = utils.url.getSubdir(), + ghostPathRegex = new RegExp('^' + subdir + '/ghost/(.+)'), + ghostPathMatch = req.originalUrl.match(ghostPathRegex); + if (ghostPathMatch) { return res.redirect(utils.url.urlJoin(utils.url.urlFor('admin'), '#', ghostPathMatch[1])); }