Next.js Discord

Discord Forum

Nextjs 15 Slug 404

Answered
Champagne D’Argent posted this in #help-forum
Open in Discord
Champagne D’ArgentOP
What am I missing with the [slug].tsx here it returns a 404.

I have this route app/living/location/[slug]/page.tsx but if I visit this route:

http://localhost:3000/living/location/test

It returns a 404 page why?
Answered by Giant panda
I was curious because you initially wrote [slug].tsx in a fashion that was used in the pages router which is why I asked. Have you tried to clean the .next cache folder as well as restarting the dev server after doing so?
View full answer

5 Replies

Giant panda
What does your file hierarchy actually look like? Please share a screenshot.
Champagne D’ArgentOP
It is in german I translated it to english if you are wondering issue in the slug inside wohnen/anlagen/[slug]/page.tsx
Giant panda
I was curious because you initially wrote [slug].tsx in a fashion that was used in the pages router which is why I asked. Have you tried to clean the .next cache folder as well as restarting the dev server after doing so?
Answer
Giant panda
Also check whether your respective page file has code path returning 404 unexpectedly.
Champagne D’ArgentOP
@Giant panda thats worked thanks