I have a dynamic route:
test/[id].js
When user clicks on a link pointing to /test/1
Next.js ends up rendering the proper page as intended.
The funny business starts when I want to have /test/1
url masked with anything else.
<Link href="/test/1" as="/any/thing/here">
As far as I understand the above code should:
- move user to test/1 and render test/[id].js,
- hide the domain.com/test/1 url behind domain.com/any/thing/here.
What happens is it does not point to test/[id].js at all, just returns a 404.
Sandbox link with broken code:
https://codesandbox.io/s/nervous-silence-z62s1?file=/pages/index.js
What am I doing wrong here? I have a really long and complex urls with lots of slashes I have to use with Next.js dynamic routing, and I don't see any other solution than using "as"... I'm pretty much sure I used to use it a few years back and it just worked! Seems like it worked for this guy as well: Linking to dynamic routes in Next.js
If Next.js changed something then how I recreate this functionality easily?