Redirect all routes to index.html (PWA)


Is there an easy way to redirect for a Vue.js Router? Say the user navigates to directly, I want to load index.html and have the router capture /bar and handle routing.

Right now, Vue.js as a static site cannot do this without some sort of Node.js proxy which I want to avoid.

I can do this easily in AWS with CloudFront by forwarding 403s to index.html with response 200.

Hey, @bymarco welcome to the forums!

Can you please provide a link to the repl? This way it is easier for staff and members of the community to help you!

Also see this guide on how to share your code:

1 Like

I found the solution. Add this to your .replit file.

from = "/*"
to = "index.html"
1 Like