Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vuejs history mode with github/gitlab pages

Has anyone managed to figure out how to make Vue.js work with history mode with GitHub or GitLab Pages?

It works with hash mode, but I don't want to use hash mode for SEO related reasons.

Reference for router modes: https://router.vuejs.org/en/essentials/history-mode.html

like image 880
fisker Avatar asked Dec 06 '17 14:12

fisker


People also ask

Can you use Vue on GitHub Pages?

After you save the repository, it automatically creates a GitHub Page for you using the HTML at the root of the project. You can also set up GitHub Pages for any new or existing repositories you have on GitHub. In this post, we will create a Vue. js project and then deploy it to GitHub Pages.

Does Gitlab uses Vue?

Gitlab even created their own docs on how they use Vue.


1 Answers

2021 Answer

For those using GitLab there is now support to redirect to index.html using a _redirects file in your public folder.

Steps:

  1. Create a file named _redirects in the public folder
  2. Add this snippet line to that file

Snippet:

/* /index.html 200

You can read up on it here: https://docs.gitlab.com/ee/user/project/pages/redirects.html#rewrite-all-requests-to-a-root-indexhtml

like image 82
Alex Y Avatar answered Oct 06 '22 19:10

Alex Y