Next.js Discord

Discord Forum

How to apply redirects (through next.config.mjs) for dynamic routes

Unanswered
Asiatic Lion posted this in #help-forum
Open in Discord
Asiatic LionOP
I tried adding the below. It works fine when I hit a route like /launchpad/team1/skills, but I also see the redirect happening (sometimes?) on launchpad/team1 route as well.
 async redirects() {
    return [
      {
        source: "/launchpad/:team/skills",
        destination: "/launchpad/:team/skills/summary",
        permanent: true,
      },
    ];
  }


I'm in an App Dir app/launchpad (although I have some legacy pages/* files too).

Has anyone tried redirects on the dynamic routes in the new app dir?

0 Replies