From d98f8f7899f021a43b74e53787b10d446dbea5cf Mon Sep 17 00:00:00 2001 From: Maurici Abad Gutierrez Date: Sat, 28 Nov 2020 17:25:45 +0100 Subject: [PATCH 1/2] Easier Netlify setup --- docs/guide/deployment.md | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/docs/guide/deployment.md b/docs/guide/deployment.md index 2279018064..cc94568c3d 100644 --- a/docs/guide/deployment.md +++ b/docs/guide/deployment.md @@ -169,15 +169,31 @@ Commit both the `.gitlab-ci.yml` and `vue.config.js` files before pushing to you Also checkout [vue-cli-plugin-netlify-lambda](https://github.com/netlify/vue-cli-plugin-netlify-lambda). -In order to receive direct hits using `history mode` on Vue Router, you need to create a file called `_redirects` under `/public` with the following content: +#### Use history mode on Vue Router + +In order to receive direct hits using `history mode` on Vue Router, you need to redirect all trafic to the `/index.html` file. + +> More information on [Netlify redirects documentation](https://www.netlify.com/docs/redirects/#history-pushstate-and-single-page-apps). + +##### Recomended method + +Create a file called `netlify.toml` in the root fo your repository wit the following content: + +```toml +[[redirects]] + from = "/*" + to = "/index.html" + status = 200 +``` + +##### Alternative method +Create a file called `_redirects` under `/public` with the following content: ``` # Netlify settings for single-page application /* /index.html 200 ``` -More information on [Netlify redirects documentation](https://www.netlify.com/docs/redirects/#history-pushstate-and-single-page-apps). - If you are using [@vue/cli-plugin-pwa](https://cli.vuejs.org/core-plugins/pwa.html#vue-cli-plugin-pwa) make sure to exclude the `_redirects` file from being cached by the service worker. To do so, add the following to your `vue.config.js`: ```javascript From 414a7f3f3d1a59c488a008684040983ee0c81a31 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Fri, 18 Dec 2020 17:05:31 +0800 Subject: [PATCH 2/2] docs: update link [skip ci] --- docs/guide/deployment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guide/deployment.md b/docs/guide/deployment.md index cc94568c3d..f8d2bc9574 100644 --- a/docs/guide/deployment.md +++ b/docs/guide/deployment.md @@ -173,7 +173,7 @@ Also checkout [vue-cli-plugin-netlify-lambda](https://github.com/netlify/vue-cli In order to receive direct hits using `history mode` on Vue Router, you need to redirect all trafic to the `/index.html` file. -> More information on [Netlify redirects documentation](https://www.netlify.com/docs/redirects/#history-pushstate-and-single-page-apps). +> More information on [Netlify redirects documentation](https://docs.netlify.com/routing/redirects/rewrites-proxies/#history-pushstate-and-single-page-apps). ##### Recomended method