如何在裸域中配置 Google Domains + Heroku [英] How to configure Google Domains + Heroku w a Naked Domain

查看:29
本文介绍了如何在裸域中配置 Google Domains + Heroku的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Heroku 和 Google Domains 在网络浏览器中加载了一个域.现在域加载了 www:http://www.XXX.com.

如果我输入不带 WWW 的 URL,例如 http://XXX .com,我会在 Chrome 中收到以下错误:找不到 XXX.com 的服务器 DNS 地址"

我需要做什么才能发生以下情况:

  1. 这会加载 - http://mydomain.com
  2. http://www.mydomain.com 重定向到 http://mydomain.com

谢谢

解决方案

恕我直言,你应该:

1/将您的 heroku 域设置为 http://example.com.所有信息都在 Heroku 文档中.

Heroku 应该使用 http://example.com 为您的网站提供服务.

2/您需要在 Google Domains 中将您的 http://www.example.com 重定向到 http://example.com.为此,您需要在 Google Domain 控制台的网站选项卡下设置网络转发.文档很简单.

任何 http://www.example.com 请求都应该转发到 http://example.com.

更新

由于您的需要,我想知道是否最好不要禁用裸到 www 重定向,让两个域都指向您的 heroku 实例并为它们获取 SSL 证书(使用 let's encrypt 使事情变得容易).

这是一个 教程.

我希望这会有所帮助!

I have a domain loading in a web browser using Heroku and Google Domains. Right now the domain loads with a www: http://www. XXX .com.

If I enter the URL w/o the WWW like http:// XXX .com I get the following error in Chrome: "XXX.com’s server DNS address could not be found"

What do I need to do so that the following happens:

  1. This loads - http:// mydomain.com
  2. http://www. mydomain.com redirects to http:// mydomain.com

Thank you

解决方案

IMHO, you should:

1/ Set your heroku domain to be http://example.com. All the info are in the Heroku documentation.

Heroku should serve your site using http://example.com.

2/ You need to redirect in Google Domains your http://www.example.com to http://example.com. To do this, you need to set web forwarding in the Google Domain console under the website tab. The documentation is straight forward.

Any http://www.example.com request should be forwarded to http://example.com.

UPDATE

Due to your needs, I am wondering if the best is not to disable the naked to www redirection, have both domain points to your heroku instance and get a SSL certificate for them (using let's encrypt makes things easy).

Here is a tutorial.

I hope this helps!

这篇关于如何在裸域中配置 Google Domains + Heroku的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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