Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

261
Views
Can i achieve dynamic routing in nextJS for nested routes with unknown number of slugs?

In nextJS routing is path based for pages but is there anyway to achieve a common route for following:

http://localhost/abc/element/id
http://localhost/abc/def/element/id
http://localhost/abc/def/ghi/element/id

Note how /element/id is common in all

I understand i can make nested folder structure and redirect them to same component but i want to avoid the same as we can further more nesting.

Do take care that you can not use catch all as it should be at the end just before file extension. Also, i don't want to add an extra prefix to the URL as that makes the older url's invalid.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!