Index.html not redirecting to root


Currently, all the pages on the site are accessible with and without index.html at the end of the URL.

I turned on pretty URLs, but that didn’t work.

I then added this code:

from = "/*/index.html"
to = "/:splat:"
status = 200
force = false

Even that’s not working. If I add true to force, it shows a 404 error, but it won’t strip index.html off of the URLs.

What should I do?

Netlify site name:

This is not a supported configuration. Everything after * is ignored. So, you’re essentially redirecting the same page to itself.

That is expected. When you load /, you’re essentially loading /index.html for any given folder. It’s the same thing and should not cause any problems.

If it’s not working for your use case, you can try using Edge Functions to strip off and redirect to a URL without index.html.