404 on refresh. Redirect not working

New to Netlify and I thought I had things figured out but now I can’t resolve this issue.

I built my site using Sveltekit. Everything is working fine, but when I refresh on a page that is not pre-rendered I get:

Page Not Found

Looks like you’ve followed a broken link or entered a URL that doesn’t exist on this site.

I click “Back to our site” and it takes me back to index.html.
But then when I navigate back to that page and refresh again it doesn’t take me back to index.html it just tries to refresh the current page and it stays on that 404 warning.

My netlify.toml file

from = “/*”
to = “/index.html”
status = 200

My _redirects file

  • /.netlify/functions/sveltekit-render 200

/* /index.html 200

The _redirects file is in my build folder with my html files and the netlify.toml file is in the root folder of my Sveltekit project. But adding these or modifying them doesn’t seem to change anything. I’m manually deploying this at the moment.

What am I doing wrong?

Thanks in advance!

Please share site name, deploy id, account id or any other identifying information.

Site ID : 02341fa5-c4dd-4543-83ea-6a7a50245596

:wave: @makr_t ,

It looks like you only have one redirect rule for * /.netlify/functions/sveltekit-render 200 implemented in your latest deploy. Did you remove the /* /index.html 200 redirect? If so, could you add that redirect rule and let us know if it helps?

Oh right I re deployed since I first posted this. Sorry about that. I added the redirect again. I put it first in the file, and it reloads the page with no formatting. Otherwise it doesn’t do anything.

You don’t need the

redirect as you don’t have any functions. The current problem is because you are linking relative assets incorrectly.

You should remove the . from the start of the URLs.

Thank you for the response!
I guess that is from the netlify adapter with Sveltekit. I removed the . And it isn’t giving me the same error in the browser but now I’m getting an error in the console

Failed to load module script: Expected a JavaScript module script 
but the server responded with a MIME type of "text/html". 
Strict MIME type checking is enforced for module scripts per HTML spec.

Still not quite there, but it’s better than before.

Your JavaScript code still has that:

This looks like a problem with either your code or SvelteKit than Netlify.

It was an issue with the Sveltekit build I guess. I connected to my github repository and deployed it that way and it’s working now.