Next.js Discord

Discord Forum

Next nested route not working on netlify

Answered
Sirex woodwasp posted this in #help-forum
Open in Discord
Avatar
Sirex woodwaspOP
import Link from "next/link";
...
<Link href={"/market/gempack"}>
...

on localhost, it's working well when i click the link, it smoothly redirects to the prefetched route but on netlify deployment, not working at all, just showing 404 page after i clicked the link and seems it was hard refreshing the page when clicked
The page is located in /src/market/gempack/index.tsx
Any helps would be appreciated here
Answered by Persian
create "gempack.tsx' file in /src/market folder instead of the index.tsx file
View full answer

30 Replies

Avatar
Sirex woodwaspOP
bump
Avatar
any netlify errors?
or console
Avatar
Sirex woodwaspOP
no errors, just it's not going to the expected page, but shows 404
Avatar
Sirex woodwaspOP
bump
Avatar
Persian
bump
have you ever tried to host the website on vercel or other service?
Avatar
Sirex woodwaspOP
didn't have a chance to do that but really curious why it's not working on netlify
Avatar
Persian
it wont take so much time. if it works on other platforms, netlify should be a main problem
Avatar
Sirex woodwaspOP
okay mate, i will try another one
Avatar
Persian
i have used netlify service and imo its not a good option for you
lmk if it works or not anyway
Avatar
Sirex woodwaspOP
alright man
Avatar
Persian
or, did you try to change the Link url to absolute url?
Avatar
Sirex woodwaspOP
can you give me an example?
Avatar
Persian
anyway i am sure that your code will work correctly on vercel
Avatar
Sirex woodwaspOP
i c, no worries man, am trying to build on vercel
will let you know shortly if it works
Avatar
Persian
okay
Avatar
Sirex woodwaspOP
unfortunately, not working as well on vercel.. 😦
Avatar
Persian
hmm...
can you share the screenshot?
Avatar
Persian
create "gempack.tsx' file in /src/market folder instead of the index.tsx file
Answer
Avatar
Sirex woodwaspOP
hmm.. okay, will try
should take a few mins to fix and deploy, will let you know if it works
i don't know how it does but anyway it worked!
Avatar
Persian
sounds good
Avatar
Sirex woodwaspOP
thanks my man 😄
Avatar
Persian
sure