【问题标题】:Redirecting www.example.com to example.com using github pages?使用 github 页面将 www.example.com 重定向到 example.com?
【发布时间】:2019-05-11 01:16:07
【问题描述】:

如果我们在 Github 页面上使用自定义域托管了 https://example.comhttps://www.example.com,并且我们希望从 https://www.example.com 重定向到 https://example.com,我们该怎么做。

IIUC 这必须在 Github 上进行设置,因为他们正在处理自定义域的 DNS 和 HTTPS 证书生成。

【问题讨论】:

    标签: git .htaccess github dns github-pages


    【解决方案1】:

    [Github] 正在处理自定义域的 DNS

    不,您域的 DNS 由您处理。您可以将您的 ACNAME 记录指向 Github 管理的 IP 地址。

    要解决您的问题,您需要将www.example.comCNAME 指向example.com。您还需要检查example.github.io 存储库中的文件CNAME 是否只有example.com 而没有www

    https://help.github.com/en/articles/setting-up-a-www-subdomain

    看这个例子:

    $ host cheetahtemplate.org
    cheetahtemplate.org has address 185.199.111.153
    cheetahtemplate.org has address 185.199.108.153
    cheetahtemplate.org has address 185.199.109.153
    cheetahtemplate.org has address 185.199.110.153
    
    $ host www.cheetahtemplate.org
    www.cheetahtemplate.org is an alias for cheetahtemplate3.github.io.
    

    https://github.com/CheetahTemplate3/cheetahtemplate3.github.io/blob/master/CNAME

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-09-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-17
      • 1970-01-01
      • 2020-09-24
      相关资源
      最近更新 更多