#404 page after navigating from an external link
1 messages · Page 1 of 1 (latest)
Hmm, I don't know enough to give you a confident answer yet.
However, if you're experiencing issues with navigation and 404 errors in your Next.js application, it might be related to how you're handling internal navigation. According to the Next.js documentation, you should use the next/link component for internal navigation instead of regular HTML <a> tags to prevent unnecessary full-page refreshes and to enable client-side route transitions between pages. This provides a single-page app experience (source (https://nextjs.org/docs/messages/no-html-link-for-pages)).
For your specific issue with 404 errors after navigating back from an external site, it's not clear from the provided extracts what might be causing this problem. It could be related to the server configuration, routing issues, or something else entirely.
To troubleshoot this issue, you might want to check the following:
- Ensure that your page files are correctly named and located in the
pagesdirectory. - Verify that your
next.config.jsfile does not contain any incorrect redirects or rewrites that might affect navigation. - Check for any custom error handling, such as a custom 404 page, that might be incorrectly configured (source (https://nextjs.org/docs/pages/building-your-application/routing/custom-error#404-page)).