GitHub 页面 https/www 重定向 [英] GitHub Pages https/www Redirect

查看:10
本文介绍了GitHub 页面 https/www 重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何让

  • 保存设置并等待 www.example.com 解析并运行.

  • 删除 www. 前缀并再次保存.

  • 等待浏览器和 DNS 缓存失效.

  • 所有组合都应指向 https://example.com/,并且不应出现 SSL 错误.

  • How can I get https://www.test.com to redirect to https://test.com when using GitHub pages to host a static website?

    I recently enabled TLS (provided by GitHub/Lets Encrypt) for my static site by setting A records at my DNS provider (namecheap). I've also chosen to "Enforce HTTPS" option in my GitHub repository's settings, which handles redirecting requests from http://test.com to https://test.com. I have a redirect configured through my DNS provider which forwards http://www.test.com to https://test.com, but the one missing piece of the puzzle is forwarding https://www.test.com to https://test.com.

    Regarding this issue, GitHub says, "If your domain has HTTPS enforcement enabled, GitHub Pages' servers will not automatically route redirects. You must configure www subdomain and root domain redirects with your domain registrar."

    ... and my DNS provider says, "It is not possible to set up a URL redirect in the account for the TCP port forwarding from http://www.domain.tld (uses port 80) to https://www.domain.tld (working via port 443)."

    I seem to be caught in an infinite loop of the two services saying the other should provide this functionality.

    解决方案

    What worked for me:

    • Change your custom domain to be prefixed with www., like this:

    • Save the settings and wait until www.example.com resolves and works.

    • Remove the www. prefix and save again.

    • Wait for browser and DNS caches to invalidate.

    • All combinations should lead to https://example.com/ and no SSL error should appear.

    这篇关于GitHub 页面 https/www 重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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