我在GitHub上有一个项目,它存在于私人存储库中,我不是所有者,而是协作者,它是我的朋友回购。
我的目标是为我们的stie制作目标网页,因此,当我们从NameCheap购买域名时,我跟随this tutorial。
问题是,我们有两个域,一个是swopular.de
,另一个是swopular.com
。
我的想法是将这两者放在CNAME文件中,如下所示:
CNAME
swopular.de
swopular.com
但是现在当我尝试访问该网站时,我收到以下错误:
404
There isn't a GitHub Pages site here.
If you're trying to publish one, read the full documentation to learn how to set up GitHub Pages for your repository, organization, or user account
我在上面发布的教程中引起怀疑的是这一步,在NameCheap服务器上我应该......
Here you will need to create three records for your domain:
- A record for @ pointing to 192.30.252.153
- A record for @ pointing to 192.30.252.154
- CNAME record for www pointing to your username.github.io (username should be replaced with your actual GitHub account username):
在那里我把username.github.io
把我想创建网站的项目实际存放在一个存储库中,这是一个子域 - 但是NameCheap不允许我在该字段中输入子域名,像username.github.io/XXX
也许在网络开发方面有更多经验的人可能知道如何解决这个问题?
答案 0 :(得分:3)
Github Pages的CNAME
文件仅支持1个CNAME。 (https://help.github.com/articles/about-supported-custom-domains/)
我建议做的是选择一个域作为主要域名。由于de
是针对特定国家/地区的TLD且com
是通用的,因此我会选择com
。
要允许您的域在www.swopular.com
托管并将swopular.com
重定向到www
子域,Github Pages的CNAME
文件应仅包含www.swopular.com
。与之关联的DNS记录应该是您提到的那些,
- A record for @ pointing to 192.30.252.153
- A record for @ pointing to 192.30.252.154
- CNAME record for www pointing to your username.github.io (username should be replaced with your actual GitHub account username):
服务器端应该注意在CNAME
记录中添加额外的扩展程序,只在[username].github.io
记录中包含CNAME
对于de
域,我建议使用Namecheap的HTTP重定向服务。 (https://www.namecheap.com/support/knowledgebase/article.aspx/385/77/how-do-i-set-up-a-url-redirect-for-a-domain)然后,您可以将根de
和www.swopular.de
重定向到www.swopular.com