仅在自定义子域下显示GitHub项目页面,绝不通过文件夹路径 [英] Showing a GitHub project page only under custom subdomain, never via folder path

查看:129
本文介绍了仅在自定义子域下显示GitHub项目页面,绝不通过文件夹路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个组织GitHub Pages存储库设置,它通过一个自定义域名(比如 Github回购并添加 gh-pages 分支。

  • 添加您的 index.html 和仅包含一行的CNAME文件 sub.domain.tld



  • <有关更多详情,请参见


    I have an organization GitHub Pages repository set up, and it's served through a custom domain name (let's say, http://example.com/).

    I also have a couple of projects pages which I want to be accessible via a subdomain only (let's say, http://project.example.com/), but it turns out that they will also be accessible at a different URL (that is, http://example.com/projectname/).

    Is there any way to avoid this? Both the organization pages and the project pages have CNAME entries set up, and the DNS records seem to be correctly configured.

    解决方案

    http://project.example.com/ will also be accessible at http://example.com/projectname/

    > Is there any way to avoid this?

    I was able to avoid this via a project pages setup for each subdomain as well as the domain. It didn't work with CNAME records so I had to use A records in the server side configuration. Every record would point to the Github IPs 192.30.252.153 and 192.30.252.154, using the subdomain as host or @ for the domain.com part.

    For future users looking into how to map a Github page to a domain / subdomain:

    1. Create new Github repo and add a gh-pages branch.
    2. Add your index.html and a CNAME file with only one line sub.domain.tld.

    See this gist for more details.

    这篇关于仅在自定义子域下显示GitHub项目页面,绝不通过文件夹路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆