Next.js Discord

Discord Forum

Redirecting to another page from a page in app router

Answered
Oak saucer gall posted this in #help-forum
Open in Discord
Oak saucer gallOP
I have a server-side page that would fetch the current user at the beginning, and if the user has a particular attribute, need to redirect them to another page. What's the best way to do this from a server component? (eg: you come to /dashboard initially, but it wants to send the user to /start instead)
Answered by Giant panda
use redirect()
View full answer

2 Replies

Giant panda
use redirect()
Answer
Oak saucer gallOP
ooh, how did i miss this? Thank you very much @Giant panda !