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
@Barbary Lion 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
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
Answer
@Barbary Lion solved?
Barbary LionOP
Yes
@Barbary Lion Yes
which solution do you use now?
Barbary LionOP
The next rewrites one window one have some issue when i implemented