Is there a way for mask the frontend url in nextjs ?
Answered
Barbary Lion posted this in #help-forum
Barbary LionOP
i wanna mask the url
ex - http://localhost:3000/asd/123123123123131/234234234234234/
i wanted http://localhost:3000/asd/23/45
so only in frontend i wanna change them
ex - http://localhost:3000/asd/123123123123131/234234234234234/
i wanted http://localhost:3000/asd/23/45
so only in frontend i wanna change them
8 Replies
you can either use
Keep in mind, that if you doing this for security reasons, that this won't be secure.
window.history.pushState
or window.history.replaceState
. Both should work fine. You can get code example from here: https://nextjs.org/docs/app/building-your-application/routing/linking-and-navigating#using-the-native-history-apiKeep in mind, that if you doing this for security reasons, that this won't be secure.
Barbary LionOP
i only want it to change the display of url not the functioning like other framework have hiding url masking the real url and showing different
yea, then you can do it like I mentioned here: https://nextjs-forum.com/post/1298676389431738388#message-1298679214580564052
@Barbary Lion solved?
Barbary LionOP
Yes
which solution do you use now?
Barbary LionOP
The next rewrites one window one have some issue when i implemented