下一个js应用程序显示404时,我试图登陆任何页面,除了主页



我已经在firebase上部署了我的下一个js应用程序。当我试图直接登陆除主页以外的任何页面时,它显示的是404页面。

假设,我的应用链接是:example.com它有页面

回家

当我尝试访问example.com时,它显示了预期的主页。但是当我尝试访问example.com/about时,它显示404页面。但问题是,当我访问example.com/about并手动重新加载页面时,about页面会按预期显示。

我已尝试在firebase中部署。

这里是我的脚本命令

"dev": "next dev",
"build": "next build && next export",
"start": "next start",

firebase.json中启用rewrites将所有请求重定向到index.html文件。

"hosting": {
// ...
// Serves index.html for requests to files or directories that do not exist
"rewrites": [ {
"source": "**",
"destination": "/index.html"
} ]
}

相关内容

最新更新