Next.js Discord

Discord Forum

Nextjs 15 Slug 404

Answered
Champagne D’Argent posted this in #help-forum
Open in Discord
Avatar
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 Asian black bear
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

Avatar
Asian black bear
What does your file hierarchy actually look like? Please share a screenshot.
Avatar
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
Image
Avatar
Asian black bear
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
Avatar
Asian black bear
Also check whether your respective page file has code path returning 404 unexpectedly.
Avatar
Champagne D’ArgentOP
@Asian black bear thats worked thanks