Unsure why dynamic route isn't working
Answered
Giant ichneumon wasp posted this in #help-forum
Giant ichneumon waspOP
I have a basic dynamic route
If I copy the very basic example shown here: https://github.com/vercel/next.js/blob/canary/test/e2e/app-dir/app/app/catch-all/%5B...slug%5D/page.js
it still doesn't seem to be working. Any ideas?
search/[...slugs]/page.tsx. It doesn't seem to be picked up by nextjs at all. When I navigate to it, it shows the 404 page (with no redirect).If I copy the very basic example shown here: https://github.com/vercel/next.js/blob/canary/test/e2e/app-dir/app/app/catch-all/%5B...slug%5D/page.js
it still doesn't seem to be working. Any ideas?
Answered by Giant ichneumon wasp
async rewrites() {
return [
{
destination: '/en/:slug*',
source: '/:slug*',
},
];
},31 Replies
Giant ichneumon waspOP
I'll note that I did try it in a fresh new app, and it worked as expected, but I'm completely unsure of where to start looking for what's going wrong in my own app
@Ray could you show the folder structure?
Giant ichneumon waspOP
export default function Page({ params }: any) {
return (
<>
<h1 id="text" data-params={params.slug.join('/') ?? ''}>
hello from /catch-all/{params.slug.join('/')}
</h1>
</>
);
}@Giant ichneumon wasp Click to see attachment
oh only this route you have?
Giant ichneumon waspOP
i deleted the rest for testing lol
I only have a robots, layout, not-found, page, and middleware otherwise
does it work with just this route?
Giant ichneumon waspOP
none of which make any sense for why it's breaking (looking at them)
@Ray does it work with just this route?
Giant ichneumon waspOP
no, which means it's something due to those 5 files, but again, i just have zero clue where to look
middleware is verified to work properly via console logs (no redirects)
layout does zero black magic or redirecting (i'm using styled components so that setup is annoying, but otherwise...)
and robots ideally touches nothing (it wouldn't make sense)
Giant ichneumon waspOP
sanity checked, there's still a problem when I delete my custom layout and page and notfound
@Ray like this?
Giant ichneumon waspOP
yep
Giant ichneumon waspOP
yep that's why i'm confused
even this doesn't work
(that layout was force generated by next dev)
oh...
have you tried remove
.next and restart the server?Giant ichneumon waspOP
i think i found it
Giant ichneumon waspOP
async rewrites() {
return [
{
destination: '/en/:slug*',
source: '/:slug*',
},
];
},Answer
Giant ichneumon waspOP
erroneous from testing intl earlier
weird that it triggered on
/enlol
Giant ichneumon waspOP
oh wait it's backwards
welp
thanks anyway lmao