diff --git a/packages/docs/guide/essentials/history-mode.md b/packages/docs/guide/essentials/history-mode.md index 8cb720e93..af6f4e799 100644 --- a/packages/docs/guide/essentials/history-mode.md +++ b/packages/docs/guide/essentials/history-mode.md @@ -203,6 +203,20 @@ Create a `vercel.json` file under the root directory of your project with the fo } ``` +### Azure Static Web Apps + +Create a `staticwebapp.config.json` file at the root of your deployed project folder with the following: + +```json +{ + "navigationFallback": { + "rewrite": "/index.html" + } +} +``` + +In vue-cli, nuxt, and vite projects, this file usually goes under a folder named `static` or `public`. + ## Caveat There is a caveat to this: Your server will no longer report 404 errors as all not-found paths now serve up your `index.html` file. To get around the issue, you should implement a catch-all route within your Vue app to show a 404 page: diff --git a/packages/docs/zh/guide/essentials/history-mode.md b/packages/docs/zh/guide/essentials/history-mode.md index 6410d0454..3fe1cd3dd 100644 --- a/packages/docs/zh/guide/essentials/history-mode.md +++ b/packages/docs/zh/guide/essentials/history-mode.md @@ -202,6 +202,20 @@ rewrite { } ``` +### Azure Static Web Apps + +创建一个`staticwebapp.config.json`文件,包含在部署目录中,内容如下: + +```json +{ + "navigationFallback": { + "rewrite": "/index.html" + } +} +``` + +在 vue-cli、nuxt 和 vite 项目中,这个文件通常放在名为 `static` 或 `public` 的目录下。 + ## 附加说明 这有一个注意事项。你的服务器将不再报告 404 错误,因为现在所有未找到的路径都会显示你的 `index.html` 文件。为了解决这个问题,你应该在你的 Vue 应用程序中实现一个万能的路由来显示 404 页面。