Next.js Discord

Discord Forum

Google Search Console Returning 404 for /index.html

Unanswered
European anchovy posted this in #help-forum
Open in Discord
European anchovyOP
At the risk of getting flamed for asking a dumb question, I have an application that keeps showing a 404 error in Google Search Console on the /index.html route. App works fine and the urls are all fine. Is this something that can be fixed in teh next.config.js file or can I somehow tell GSC to stop tyring to index the /index.html file?

Current next.config.js file for reference:
/** @type {import('next').NextConfig} */

const nextConfig = {
  reactStrictMode: true,
  swcMinify: true,
  images: {
    domains: ["localhost"],
    remotePatterns: [
      {
        protocol: "https",
        hostname: "cdn.sanity.io",
        port: "",
      },
    ],
  },
};

module.exports = nextConfig;

5 Replies

Snowshoe
I'm no google SEO expert, but you could setup a rewrite so just points the /index.html path to /

https://nextjs.org/docs/app/api-reference/next-config-js/rewrites

Alternately you could specify a permanent redirect to google so it gets the message

https://nextjs.org/docs/app/api-reference/next-config-js/redirects
European anchovyOP
Yeah the rewrites is what keeps popping up in my Googling, but not sure if it’s solving my problem. Like, where is the /index.html file even coming from? No other page has this issue, just this one. Is there an article that explains this? Not even sure what to search for there.
Snowshoe
Probably google trying to access what it thinks should be your default file, you could put a block in your robots.txt I guess? That'd solve it, but I think the permant redirect to / would be the safer and better solution
European anchovyOP
I’ll try today and let you know if it works.
@Snowshoe Probably google trying to access what it thinks should be your default file, you could put a block in your robots.txt I guess? That'd solve it, but I think the permant redirect to `/` would be the safer and better solution
European anchovyOP
Didn’t work. No idea why that file is trying to be indexed by Google. Would think that the rewrite would work, but no dice.