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

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

问题描述

如何获取 https://www.test.com 重定向到

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

我最近通过在我的DNS提供商(namecheap)上设置A记录来为我的静态站点启用TLS(由GitHub/Lets Encrypt提供).我还在GitHub存储库的设置中选择了强制HTTPS"选项,该选项可处理来自 http://test.com 到 https://test.com .我通过我的DNS提供程序配置了重定向,该重定向将 http://www.test.com 转发到 https://test.com ,但难题中缺少的一个就是转发 https://test.com .

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.

关于此问题,GitHub说:如果您的域启用了HTTPS强制实施,则GitHub Pages的服务器将不会自动路由重定向.您必须使用域注册商配置www子域和根域重定向."

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."

...,我的DNS提供商说:无法在帐户中为从 http://www.domain.tld (使用端口80)到 https://www.domain .tld (通过端口443工作)."

... 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.

推荐答案

对我有用的东西:

  • 将您的自定义域更改为以www.为前缀,如下所示:

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

保存设置,然后等待www.example.com解析并工作.

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

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

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

Wait for browser and DNS caches to invalidate.

所有组合均应导致 https://example.com/,并且不会出现SSL错误.

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

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

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