【问题标题】:Netlify Error Page Not Found if I'm using windows.location.replace("url")如果我使用的是 windows.location.replace("url"),则找不到 Netlify 错误页面
【发布时间】:2021-09-09 18:07:25
【问题描述】:

在我的 ReactJS 应用程序中,我使用 window.location.replace("/dashboard") 在用户登录时进行重定向,并且在本地它工作正常,但在登录后在 Netlify 上我收到 Page Not Found 错误看起来你已经点击了一个损坏的链接或输入了一个 URL这个网站上不存在的。有什么建议请...

【问题讨论】:

  • 要解决这个问题,请创建 _redirect 文件以使用此内容反应公共文件夹 /* /index.html 200
  • 如果您有答案,请使用您的答案框并在此处输入您的答案,最好是在阅读How to Answer 并遵循那里的建议之后。

标签: reactjs netlify


【解决方案1】:

尝试添加完整路径。

如:

window.location.replace('https://address.com./dashboard');

【讨论】:

  • 我刚刚找到了解决方案。为了解决这个问题,我在其中创建了 _redirect 文件,以便用此内容 /* /index.html 200 对公用文件夹做出反应
【解决方案2】:

要解决此问题,请创建 _redirect 文件以将 public 文件夹 与此内容反应

/* /index.html 200

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-04-16
    • 1970-01-01
    • 2021-11-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-15
    相关资源
    最近更新 更多