我有一个组织GitHub Pages存储库设置,它's served through a custom domain name (let' s说,http://example.com/) .
我还有几个项目页面,我想只能通过子域访问(比方说,http://project.example.com/),但事实证明它们也可以在不同的URL(即http://example.com/projectname/)访问 .
有什么方法可以避免这种情况吗?组织页面和项目页面都设置了CNAME条目,并且似乎正确配置了DNS记录 .
2 回答
我能够通过每个子域以及域的project pages设置来避免这种情况 . 它不适用于CNAME记录,因此我不得不在服务器端配置中使用A记录 . 每条记录都指向Github IP 192.30.252.153 和 192.30.252.154 ,使用
subdomain
作为主机或@
作为domain.com
部分 .对于将how to map a Github page调查到域/子域的未来用户:
Create new Github repo并添加
gh-pages
分支 .添加
index.html
和仅包含一行sub.domain.tld
的CNAME文件 .有关详细信息,请参阅this gist .
我所知道的唯一解决方案是在提供该域的Web服务器上使用robots.txt文件隐藏
http://domain.tld/projectname/
内容 .http://en.wikipedia.org/wiki/Robots_exclusion_standard