【问题标题】:Github: page not found for post but opens for index.htmlGithub:找不到帖子但打开 index.html 的页面
【发布时间】:2020-07-07 19:29:09
【问题描述】:

我正在为自己创建一个个人网站,所以我将我的目录上传到了 github。该网站链接到 githubusername.github.io,当我打开它时它对我来说很好,但是当我点击该网站上的帖子时,我从 github 收到“404 File not found”错误。

该帖子有一个指向位于 index.html 中的 minesweeper.html 的链接标签。

<a href="minesweeper.html"><img src="assets/img/Minesweeperimg.png" alt="" class="img-fluid">

这是我的文件结构的图片。1

为什么会出现错误以及如何解决?当我在本地运行 html 时,它运行良好。

【问题讨论】:

  • 尝试在资产前添加/
  • 嘿@run_time_error 感谢您的回答!我是这个网站的新手,所以请原谅我缺乏对 slackoverflow 礼仪的了解。我查看了 github repo 并注意到当我将 Minesweeper.html 重命名为 minesweeper.html 时,它并没有更新 github 上的文件。我改变了它,它现在可以工作了。谢谢!

标签: html web github


【解决方案1】:

为了从您发布的 Github Pages 存储库中调用文件,URL 应采用以下格式:

https://<user>.github.io/<repository>/assets/README.md

因此,如果您的用户名是“gene”,那么您的文件应该在 URL 上可用:

https://gene.github.io/gene.github.io/minesweeper.html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-02-05
    • 2013-06-25
    • 1970-01-01
    • 1970-01-01
    • 2022-12-30
    • 2018-10-10
    • 2023-01-23
    • 1970-01-01
    相关资源
    最近更新 更多