overwrite rootlayout
Answered
Encyrtid wasp posted this in #help-forum
Encyrtid waspOP
i have folder structured like in the pic,how do i make authentication route to not get affected by rootlayout?
Answered by Captain_Ranger
You would need to shift everything down a level. So leave RootLayout as whatever is common to Auth and other pages. Create two new Layouts - One for Auth and the other for the other pages.
Edit: Essentially what was said above.
Edit: Essentially what was said above.
7 Replies
1. use route groups
2. dont just do auth checks in layout - make sure every page also has it
2. dont just do auth checks in layout - make sure every page also has it
@Encyrtid wasp i have folder structured like in the pic,how do i make authentication route to not get affected by rootlayout?
You would need to shift everything down a level. So leave RootLayout as whatever is common to Auth and other pages. Create two new Layouts - One for Auth and the other for the other pages.
Edit: Essentially what was said above.
Edit: Essentially what was said above.
Answer
Encyrtid waspOP
do i have to remove the page that is outside route folder?(which i need it as main page,btw)
@Encyrtid wasp do i have to remove the page that is outside route folder?(which i need it as main page,btw)
Do you mean remove
page.tsx from the app directory?@Captain_Ranger Do you mean remove `page.tsx` from the app directory?
Encyrtid waspOP
yes
If you need another page to act as your Landing, you can simply import it into the file.
You can also re-direct people who try to access the page:
https://nextjs.org/docs/app/building-your-application/routing/redirecting
I don't think you can remove it though.
You can also re-direct people who try to access the page:
https://nextjs.org/docs/app/building-your-application/routing/redirecting
I don't think you can remove it though.
Encyrtid waspOP
its working now,thanks a lot guys...