Next.js Discord

Discord Forum

Two routes for one page

Unanswered
Bombay-duck posted this in #help-forum
Open in Discord
Bombay-duckOP
So what I am trying to accomplish is having /id/:slug and /profiles/:slug use the same page.tsx file where I handle the logic that differs them, I've tried using a catch-all route but that also allows me to do stuff like /faq/:slug which isn't intentional.

How it should work:
/id/zwolof should use same page.tsx file as /profiles/5241, but the logic should be handled in the page.tsx itself.

What I've tried:
(See attached image)

I have been looking into parallel routing but it doesn't seem to be what I'm after, I've also looked at rewrites but I'm not sure that's it either.
Ideally It would be nice to be able to add multiple routes like [id, profiles] for the folder name to then handle the logic in the page

Logs/Errors:
No errors, no logs, it's just not doing what it's supposed to in a good way

0 Replies