Next.js Discord

Discord Forum

New NextJS project default redirects to a page that does not exist, but exists elsewhere.

Answered
Dwarf Hotot posted this in #help-forum
Open in Discord
Dwarf HototOP
Evening,

I have been having to make updates to a NextJs project, involving changing the redirects when the page loads etc. Have been having issues with this. Any default redirects placed in the next.config.mjs file does not work.

The project currently redirects to /sign-in when the site is loaded. Having to change this to rather redirect to / and display a landing page. Implements everything to do this, but the redirecting does not work; still goes to /sign-in.

I have done some googling and done most of most of fixes people have suggested, like clearing cache, remove node modules, moving project to new location.

After this all, I decided to create a new NextJS project from scratch to try some changes. When I run this fresh project with npm run dev, this new project starts redirecting to /sign-in. These files do not exist in the app folder. This project is also located in a completely different directory.

Restarting my PC also does not seem to fix this (just in case it was an issue).

I am currently stomped. I have no idea why this is occurring. Any ideas?
Answered by Dwarf Hotot
https://stackoverflow.com/a/68005465

Leaving this here. This solved my issue.
View full answer

3 Replies

Dwarf HototOP
Please tag me.
@Dwarf Hotot It seems like you have some redirection code somewhere else
Dwarf HototOP
https://stackoverflow.com/a/68005465

Leaving this here. This solved my issue.
Answer