How to properly set dynamic route in Next.js when basePath is not root? #16772
-
I set up my Next.js project to reside outside of the website root. (I placed it in /app subfolder). It all worked fine until I started to use dynamic routes for a couple of pages. I tried in three ways:
Does anyone have an idea how to solve this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Hi, on the latest version of Next.js you should no longer need to provide When using |
Beta Was this translation helpful? Give feedback.
Hi, on the latest version of Next.js you should no longer need to provide
href
andas
and you only need to provide anhref
value matching the dynamic route e.g. for/blog/[post]
you only need to provide anhref
value of/blog/post-1
now as of v9.5.3 of Next.js.When using
basePath
you should not be providing this value in thehref
oras
values as it is automatically handled.