Skip to content

Instantly share code, notes, and snippets.

@juanbrujo
Created September 28, 2020 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juanbrujo/ed8f6c19c5f16c94ce5440535730ee62 to your computer and use it in GitHub Desktop.
Save juanbrujo/ed8f6c19c5f16c94ce5440535730ee62 to your computer and use it in GitHub Desktop.
Netlify configuration for routes in a SPA
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
@frederikheld
Copy link

This is posted as the simple solution for SPA routing on Netlify all over the place but it doesn't work at all for me.
My static assets are located in /assets/some-asset.css. If I enter the SPA from root, it loads the assets correctly. But if I enter the SPA from /some/path, it tries to load the assets from /some/path/assets/some-asset.css` which - obviously - fails.
I'm on Vue3 with vue router. Do you have any Idea what is going wrong?

@stomachfat
Copy link

@frederikheld super late reply and not sure if this'll help... I got it to work by writing

# Redirects from what the browser requests to what we serve
/*  /index.html

into _redirect in the published directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment