Next.js Discord

Discord Forum

Getting index.html for dynamic routes in nextjs in production

Unanswered
Spectacled bear posted this in #help-forum
Open in Discord
Spectacled bearOP
Hi, im using nextjs for my projects, i want to read the value of [username] and use it, it is working fine in local but when im working on production, the dynamic value is always index.html

8 Replies

Spectacled bearOP
Spectacled bearOP
Hi, could anyone help? I've tried asking in github discussion too
Spectacled bearOP
this is the issue
Netherland Dwarf
maybe you got a conflict in routing with what is in the groups folders (those wrapped into parenthesis). Be aware that you should not have static routing next to dynamic routing.
Like lets say you got myapp/home and you got myapp/[someParams]
This may result in a conflict as next cannot switch to the right routing behavior.
Netherland Dwarf
Yeah i know that can sound silly but i dont have any other idea 🤷‍♂️
I experienced almost the same problem and it was related to static pages standing next to dynamic pages.
There's nothing automatic and no magic, sometimes, the doc just dont says some details. I've checked and they do not mention that dynamic and static should not be at the same level. They also don't say that it can be like that. So it can be worth to give it a try.
@Spectacled bear Hi, im using nextjs for my projects, i want to read the value of [username] and use it, it is working fine in local but when im working on production, the dynamic value is always index.html
hi, please do not repost the question in another post. you may bump this post once a day if you want it to gain attention