Priyanshu
Priyanshu

Reputation: 144

Vue js app returns 404 in github pages but works fine on localhost

So I have a Vue Js based app that I have hosted on Github pages. But the problem is that webpage loads correctly on index url and other pages also load successfully but if you refresh the page it returns a 404.

The below image shows how the page looks while loading the website normally. normally loaded page

But if you refresh the above page, it will return a 404.

404 error

The source code of the app is available at : Repository URL

The app works perfectly fine on localhost though.

Upvotes: 0

Views: 1458

Answers (1)

Vanojx1
Vanojx1

Reputation: 5584

As you cannot access server side config files i think you ve 2 ways:

  1. Create a 404.html file with the same content of your index.html file ( in the public folder )

  2. Set the vue router to hash mode

Upvotes: 1

Related Questions