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

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

问题描述

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

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.

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

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. 这会加载 - http://mydomain.com
  2. http://www.mydomain.com 重定向到 http://mydomain.com
  1. This loads - http:// mydomain.com
  2. http://www. mydomain.com redirects to http:// mydomain.com

谢谢

推荐答案

恕我直言,您应该:

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

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

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

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

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

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.

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

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

更新

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

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

这是一个 教程.

我希望这会有所帮助!

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

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