not-found not working with dynamic routing #57938
Replies: 6 comments 1 reply
-
+1 on this issue. |
Beta Was this translation helpful? Give feedback.
-
@johnny-prescott Hi, did you find a solution for this? I'm having a similar issue where the layout of a dynamic catch all folder is still rendered even if the page inside the dynamic catch folder call the notFound() |
Beta Was this translation helpful? Give feedback.
-
i found a solution here. not official but working. |
Beta Was this translation helpful? Give feedback.
-
I really needed to find a solution to get 404s working properly with Next's recommended routing pattern for internationalization. They recommend you place everything to be localized in a dynamic I worked out an approach that does not require redirects. I noticed that layouts in catchall routes are working, despite them not working in dynamic routes. So my solution was to place a catchall route as a sibling to the dynamic route:
The contents of
...which sets up the routes so that anything having at least one segment, but not caught by any route within You can import and re-export the locale route's layout for not-found, or make a custom layout. |
Beta Was this translation helpful? Give feedback.
-
Just experienced it, can confirm it's bugged |
Beta Was this translation helpful? Give feedback.
-
still bugged 👋🏻 |
Beta Was this translation helpful? Give feedback.
-
hi,
I've been trying to implement not-found wiht my routing but have been unable to do so properly so far.
Here's what my routing look like:
Since I'm using dynamic-config, it seems that I can't put it in the root or it'll require a root-layout, which makes everything bugs out.
I've tried to put it (like it is now) int he [locale] folder, and then calling notFound() to trigger the closesy not-found.tsx but it doesn't work. I get a 404 but the default one and not mine. Each of the page at the end of the dynamic routes call notFound() if not data is found for the route it is calling. Simple, but can't have it render my own not-found.
I tried a solution from a githuub issue where they create a global one using [[...not-found]] bu then I get an error saying I can't have a catch-all and a dynamic path at the same times.
Not sure what to do exactly to make it work.
If anyone knows, that'd be great.
Beta Was this translation helpful? Give feedback.
All reactions