Next.js Discord

Discord Forum

Link component redirect from root

Answered
American Chinchilla posted this in #help-forum
Open in Discord
American ChinchillaOP
what i need to type as href in Link so it redirects to the same url from each route

lets say im currently at /clients/groups/1 route and i want to redirect to /clients/2 page, but instead it redirects to /clients/group/clients/2
Answered by B33fb0n3
if your write your href like "/clients/2" you will be redirected to "/clients/2". So set your href to "/client/2" and check if that works. Else provide a reproduction via jsfiddle or https://codesandbox.io/
View full answer

4 Replies

@American Chinchilla what i need to type as href in Link so it redirects to the same url from each route lets say im currently at `/clients/groups/1` route and i want to redirect to `/clients/2` page, but instead it redirects to `/clients/group/clients/2`
if your write your href like "/clients/2" you will be redirected to "/clients/2". So set your href to "/client/2" and check if that works. Else provide a reproduction via jsfiddle or https://codesandbox.io/
Answer
American ChinchillaOP
oh alr thanks
i guess the / solves it haha
@American Chinchilla i guess the `/` solves it haha
haha yea. Happy to help