Disable wp-admin redirect in Ghost CMS

As you can see, I have reworked my website using Ghost. Several months ago I have found a post at the Uberspace wiki and was already curious about the CMS based on node.js. I tested it but stayed with Wordpress for a while. About the weekend I was a little bit annoyed of Wordpress and its peculiarities so the decision has been made to change finally to Ghost.

Today I have checked my bookmarks and detected that my old wp-admin bookmark is still working. For several reasons I decided to disable this "feature" and also the redirects for admin, login, etc.

If you want to do the same, you just have to edit /core/server/routes/frontend.js and remove the following lines:

// redirect to /ghost and let that do the authentication to prevent redirects to /ghost//admin etc.
    router.get(/^\/((ghost-admin|admin|wp-admin|dashboard|signin|login)\/?)$/, function redirectToAdmin(req, res) {
        utils.redirect301(res, subdir + '/ghost/');
    });

Save your changes to the file and restart Ghost. Now if somebody is trying to access wp-admin a 404 error will occur.

Dennis Lauton

Guy from Bavaria. Has to work at his job with SAP. Private he is addicted to everything else with technology. Loves Linux and macOS.

Bavaria