Next.js Discord

Discord Forum

How do I utilize usePathname in App Router to detect if a user typed in a certain path?

StoicWanderer posted this in #help-forum
Open in Discord
Hello NextJs Users,

My question is about disallowing a user to manually navigate to a certain path in my app and I thought I could use usePathname() for this purpose. The only thing I don't understand how can I redirect the user if they type in a certain url path in the url bar?

Can anyone help me out here, please?

5 Replies

Shy Albatross
usePathname is client side so it makes no sense for youru se case
The only thing here is that I am redirecting the user with Clerk from they sign-up page after they sign up, but if they type it in, they shouldn't be allowed to load the page like that
they have doc for it