github-pages - GitHub页面: Redirect custom. domain.tld> user.github.io/project/

标签 github-pages

正如主题所说,我想将自定义域重定向到特定项目的gh-pages分支。

我可以轻松地获得标准行为:

  • custom.domain.tld> user.github.io (静态内容位于github.com/user/user.github.io/master分支中)
  • custom.domain.tld/project/> user.github.io/project (静态内容位于github.com/project/gh-pages分支中)

  • 但是我不知道如何得到这个:
  • custom.domain.tld> user.github.io/project (静态内容所在的位置
    github.com/user/project/gh-pages分支)

  • 我非常感谢指针。

    最佳答案

    如果custom.domain.tld当前指向username.github.io,则需要从user.github.io存储库的Master分支中删除CNAME文件。然后,将相同的CNAME文件(内容为custom.domain.tld)添加到Project存储库的gh-pages分支。如果您已经为user.github.io信息库正确设置了DNS,则无需在其中进行任何更改,GitHub上的新CNAME设置将为您解决。

    注意事项:当您向用户页面存储库分配自定义域(例如custom1.domain.tld)时,该用户帐户中的所有项目页面都将继承其各自的custom1.domain.tld/project地址以及任何直接分配的域(例如custom2.domain)。 tld)。

    例如,我有:

  • www.nicksuch.com> nicksuch.github.io
  • www.openkentucky.org> nicksuch.github.io/openkentucky(也可以从www.nicksuch.com/openkentucky访问)
  • DNS设置:CNAME-www> nicksuch.github.io(两个域都相同,即使一个域是User Page,另一个域是Project Page)

  • GitHub的Setting up a custom domain with Pages中的更多内容。

    关于github-pages - GitHub页面: Redirect custom. domain.tld> user.github.io/project/,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21618185/

    相关文章:

    github - 使用github写一本书

    html - 在 Google Chrome 中为 GitHub 页面使用 HTTPS

    jekyll - 更改我的 github 页面的主题,页面为空

    github-pages - 如何从子文件夹运行 Svelte 应用程序?

    pagination - 我可以使用 Liquid 模板在 Jekyll 中进行适当的平铺分页吗?

    jekyll - Jekyll 的 github-pages gem 的 'gist' 标签的液体语法错误

    github.io root 不会自动渲染index.html

    javascript - 浏览器找不到背景图片文件

    reactjs - 将 React App 部署到 Github Pages Yields Manifest : Line: 1, 列 : 1, 语法错误

    github - 下划线问题: Jekyll + redcarpet == Github flavored markdown?