【问题标题】:Type URL shows 404 everytime输入 URL 每次都显示 404
【发布时间】:2022-12-12 15:07:26
【问题描述】:

如果你尝试在此处转到我的应用程序,你将获得 404 firebase 显示 - https://app.flowinglinks.com/login

我以前从未见过这个,并且做过一些 React 和 Firebase 应用程序。我正在使用 react-router-dom

我的 app.js 显示这个路由器 index.js 然后它应该显示我的身份验证路由

export default function ThemeRoutes() {
   return useRoutes([MainRoutes, AuthenticationRoutes]);
}

const AuthenticationRoutes = {
    path: '/',
    element: <MinimalLayout />,
    children: [
        {
            path: '/login',
            element: <AuthLogin3 />
        },
        {
            path: '/register',
            element: <AuthRegister3 />
        },
        {
            path: '/onboarding',
            element: <Onboarding />
        }
    ]
};

export default AuthenticationRoutes;

在我尝试启动时,任何帮助都会很棒!

【问题讨论】:

  • 你在运行什么服务器?你必须告诉你的服务器将所有的获取请求传递给你的索引,否则它会寻找不存在的文件
  • 刚刚找到答案 - 我们正在使用 Firebase,所以很容易解决。感谢您的答复

标签: reactjs firebase react-router-dom firebase-hosting


【解决方案1】:

通过将此添加到我的 firebase.json 文件来修复此问题

"rewrites": [ {
  "source": "**",
  "destination": "/index.html"
} ]

【讨论】:

    猜你喜欢
    • 2023-01-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-24
    • 1970-01-01
    • 1970-01-01
    • 2022-06-10
    • 2019-07-31
    相关资源
    最近更新 更多