You cannot use different slug names for the same dynamic path Nextjs You cannot use different slug names for the same dynamic path Nextjs express express

You cannot use different slug names for the same dynamic path Nextjs


The two routes you have provided are exactly equivalent and are not at all different. Therefore, they will be handled by a single page. There is no example of two urls that will route to different nextjs pages for the above two routes.

Anything written in [] will handle any type of value e.g 1 or 2 or any other value for that matter.

You can not make two pages to handle same request because there is no way for next or anyone else for that matter to know whether you are using route_id or location_id because these are both variables that are representing any value.

If you want to differentitate between them, either create a new route with

/route/[route_id]instead of

/location/[location_id], or use queryparams e.g

pages/[language]/location?locationid=[location_id]

And

pages/[language]/location?routeid=[route_id]