我用 vercel 构建我的博客项目时,发现只有第一次打开页面时是正常的,当页面刷新后会出现 404 找不到页面的情况,
直到我看到了这篇文章How to solve Vercel and Netlify "Page Not Found" after page refresh [SOLVED]
在 public 中添加一个名为 _redirects 的文件,并加上这行代码
/* /index.html 200
并创建一个 vercel.json 加入下面的配置,页面就能正常刷新了。
{
"rewrites": [
{
"source": "/(.*)",
"destination": "/"
}
]
}