0

enter image description hereJust started NextJS version 11.1 and all routes are working first time the website is launched. However when I click on the Home Page/index.js, I get the 404 Not Found. Any help here would be appreciated. Thanks

Here's the index.js code:

export default function Home() {
  return (
    <>
      <Head>
        <title>Home Page</title>
        <link rel="icon" href="/favicon.ico" /> 
      </Head>
      <Hero>
        <Heading>NEXT</Heading>
      </Hero>
    </>
  );
}
Jamil
  • 66
  • 1
  • 7
  • Could you provide the code of the `Link` element ? – Woohaik Nov 08 '21 at 11:36
  • Here's the code of my index.js return ( <> Home Page NEXT > ); – Jamil Nov 08 '21 at 11:44
  • @Jamil please update your question with your code rather than in a comment as it's not readable. ("```javascript" for js highlighted fenced code blocks). – johnnyBoy Nov 08 '21 at 12:03
  • @2SCSsob please check...thanks. im using a navbar for all page routes – Jamil Nov 08 '21 at 14:12
  • Where is this index.js located ? under the pages folder ? Your question needs to be updated with more information so we can understand better, where is the problem – Appy Mango Nov 08 '21 at 14:46
  • What do you mean by "when I click on the Home/index.js" ? If you mean that you have a "home" button in your navbar, you could check the link in the button and/or `console.log()` the click event to see what happens. Without further information as @AppCity stated, we can't really help you. – johnnyBoy Nov 08 '21 at 14:54
  • sorry guys im new to stackoverflow...my problem is similar to this post https://stackoverflow.com/questions/69726303/next-js-home-page-is-giving-me-404-page-not-found-after-next-js-upgrade-to-next – Jamil Nov 08 '21 at 14:57
  • @AppCity yes its under the pages folder – Jamil Nov 08 '21 at 14:57
  • Could you show us your folder structure and also the place where you navigate to home ? – Appy Mango Nov 08 '21 at 15:48
  • @AppCity please check thanks – Jamil Nov 08 '21 at 16:56

1 Answers1

2

Remove the "/index" from the Link and just add "/"

That is the default route for index.js

Appy Mango
  • 1,298
  • 5
  • 16