【问题标题】:404 error when reloading reactjs site deployed on github pages重新加载部署在 github 页面上的 reactjs 站点时出现 404 错误
【发布时间】:2020-12-02 09:32:46
【问题描述】:

我最近使用自定义域 -https://titanmarket.co.ke/ 在 github 页面上部署了一个 reactjs 网站。

网站按预期运行,但在您重新加载页面时返回 404 错误。通常,用户希望在刷新时显示当前页面。

对此的任何见解都会很棒。

【问题讨论】:

    标签: reactjs github react-router github-pages


    【解决方案1】:

    Github 页面重新加载 404 错误的超级简单解决方案。

    1. 在 src/public/index.js 文件中将以下脚本添加到底部正文:

    索引.js https://github.com/rafgraph/spa-github-pages/blob/gh-pages/index.html

    1. 在根目录下创建404.html文件:

    404.html https://github.com/rafgraph/spa-github-pages/blob/gh-pages/404.html

    阅读更多:

    来源: https://github.com/rafgraph/spa-github-pages

    【讨论】:

      【解决方案2】:

      这可能会回答你的问题linkReference,另见this

      【讨论】:

        猜你喜欢
        • 2020-01-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-09-07
        • 2023-03-31
        • 2012-02-23
        • 2019-05-17
        • 2018-10-21
        相关资源
        最近更新 更多