Url rewrites breaks url that contains multiple slashes
Unanswered
Brown bear posted this in #help-forum
Brown bearOP
Problem : I want to append an url in params, example: http://localhost:3001/https://test.com . But borwser/nextjs replaces the two slashes // with one slash / and become like this : http://localhost:3001/https:/test.com . i want it to remain the same as the user typed ( with // ) .. I know i can decoded and format it in code, but i want in the url bar to display // . more detailed explanation : https://github.com/vercel/next.js/issues/53438
8 Replies
@Brown bear Problem : I want to append an url in params, example: http://localhost:3001/https://test.com . But borwser/nextjs replaces the two slashes // with one slash / and become like this : http://localhost:3001/https:/test.com . i want it to remain the same as the user typed ( with // ) .. I know i can decoded and format it in code, but i want in the url bar to display // . more detailed explanation : https://github.com/vercel/next.js/issues/53438
you can either pass it as searchParam like
...:3001?domain=https://test.com or without the https:// like :3001/test.com@Brown bear solved?
Theres a reason url encoding exsists, I would highly recommend not having a raw url in the url params
@Brown bear solved?
Brown bearOP
Thanks for your help, so basically from what i understood that it's impossible in nextjs to use a raw url without passing it through params. But how such a website is capable of doing it: https://urlex.org/https://cut.ly ?
Thats just really weird, also way to disapear for a month when we trying to help you 😂
Idk if nextjs supports it but I would recommend NOT doing that.
Brown bearOP
well, @Jboncz thanks for your help, i appreciate it.