Now that the admin panel is largely obfuscated and unpatchable, this can be achieved with a combination of @huylv177’s fantastic suggestion, along with custom middleware:
- Create a plugin as @huylv177 covered above
- Set up custom middleware:
File: src/middlewares/redirect.js
01: "use strict";
02:
03: module.exports = (_config, { strapi }) => {
04: const redirects = ["/", "/index.html", "/admin/"].map((path) => ({
05: method: "GET",
06: path,
07: handler: (ctx) => ctx.redirect("/admin/plugins/[YOUR-PLUGIN-NAME]"),
08: config: { auth: false },
09: }));
10:
11: strapi.server.routes(redirects);
12: };
13:
*Note: “redirects” can be any name you want for the file and middleware itself.
- Use custom middleware:
File: config/middlewares.js
...
35: "strapi::session",
36: "strapi::favicon",
37: "strapi::public",
38: { resolve: "./src/middlewares/redirect" },
39: ];
40:
I found that while in develop mode, or clicking the “my-logo” link in the top left of admin panel, a refresh is needed for the route to kick in.
If anyone knows how to get around that last part, I would love an @!