I have Next.js page like page.js
so it can be reach through http://localhost:3000/page
. But for some reason I would like to get this page through an another url http://localhost:3000/my-page
So I used Link component like this way
<link href="/page" as="my-page">
<a>
My link to page
</a>
</link>
Problem is that if I refresh browser, I get a 404 error page if I do not use as
property it works.
How can I prevent this behavior?
This is because you're using a SPA, in this cases the router is different because the routes are loaded with the principal component
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.