问题原文
原帖链接 · James Anderbard · CC BY-SA 4.0
I am following the guide Google Domains: How to Forward the Root to www, but I do not see the option in my Google Domains DNS configuration to specify a synthetic record. Does anyone know how I can do this?
已采纳解答
原帖链接 · Stephen Ostermiller · CC BY-SA 4.0
If you are hosting with Heroku, they require that your DNS records all point to them by name, not by IP address. They reserve the right to change the IP address of your website at any time just by changing the DNS for the subdomains they assign to you.
There is no way to use Google Domains as your DNS host and have the domain apex (no-www) point to a name. Many DNS providers allow proxy records (also called ANAME, or ALIAS records) for the domain apex that are entered like CNAME records but where the DNS server periodically looks up the IP address and serves an A record. Google offers no such functionality. See Does Google Domains support CNAME-like functionality at the zone apex?
You are left with a couple other options:
Redirect no-www using a "synthetic record" at Google
Google has instructions here
- Sign in to Google Domains.
- Click the domain name.
- Open the menu Menu, if applicable.
- Click Website.
- Click Add a forwarding address.
- Click Edit.
- Click + Forward a subdomain.
- Enter the subdomain you want to forward.
- In the Forward to field enter the URL you want to forward it to.
- Click Forward.
Presumably they have a way of specifying the root domain as a subdomain. It is usually denoted as a blank subdomain or with @.
If you want the redirect to work over HTTPS, you'll have to then follow Google's instructions for getting a security certificate and adding it to Google Domains.
Use a better DNS host
You can keep your domain registered at Google domains but find DNS hosting elsewhere. There are many DNS hosts that now support ANAME/ALIAS records. To use such a host you would have to set your NS records at Google domains to values that your new DNS host gives you. Then you can set up all your records at your new DNS host.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
