Vue : 404 page not found after refresh page

Viewed 706

I have Vue website works correctlly on localhost ,after I build it and uploaded it on server ,the routes works fine but have two problems :

1- when I click on route and the page open ,then if i refresh the page it gives me an error 404 page not found.

2- the connect to api by axios don't work?

How can I solve them?

1 Answers

The problem is your web server. Make sure that your web server (Apache, Nginx, Express etc.) always points to the Index.html.

Your web server is not aware that the SPA should do the routing.

Related