38

I purchased a domain through Google Domains and I am hosting my app on Heroku.

I would like users to be able to access my app through the naked domain, but Google Domains does not allow CNAME's to be set for the naked domain. They have an option that allows "Subdomain forwarding", however, when that is set, the URL path is dropped.

For instance, if I set up "Subdomain forwarding" for the naked domain and I go to example.com/123, it redirects the user to example.com.

How can I forward both the domain and the path?

7
  • A very similar question was asked for domains hosted by GoDaddy, but it does not appear like the options available there, are also available in Google Domains. webmasters.stackexchange.com/questions/12777/… Commented Mar 24, 2015 at 1:42
  • Have you simply tried doing a DNS CNAME from your domain name to example.herokuapp.com??
    – closetnoc
    Commented Mar 24, 2015 at 3:12
  • 1
    @closetnoc, yes. Google Domains does not allow CNAME records for the naked domain. Commented Mar 24, 2015 at 13:18
  • 1
    @w3d: it doesn't look like it. Google Domains (and most registrars) offer a refund policy of 5 days, so I did that and then immediately bought the domain back on GoDaddy. Problem solved. Commented Mar 24, 2015 at 20:12
  • 1
    @BlairAnderson - thanks, just updated accepted answer Commented Mar 23, 2018 at 19:16

7 Answers 7

38

It took me a while, but I figured this one out. It's a 2 step process (maybe there are other ways to do it, but this works for AWS, too):

1) Use a CNAME record to set your www.example.com to forward to the true hostname.

2) To configure the naked domain, add a "Synthetic Record", and set up a "Subdomain Forward." In the subdomain text box, enter the @ sign and nothing else.

3) Select option to 'Forward path'. That should do exactly what you want.

1
  • @ did the trick. It is surprising that Google won't let you put a blank value there, but will also not tell you about @ Commented Dec 27, 2018 at 18:54
3

Subdomain forwarding has a "Forward path" option now.

2

As of right now, this is not possible, but Google Domains has a 5-day return policy, and once returned the domain becomes immediately available to be bought again from other registrars.

https://support.google.com/domains/answer/6000754

If this is a critical need, the domain can be returned and bought back from GoDaddy which does offer naked domain forwarding.

https://support.kickofflabs.com/knowledgebase/how-to-forward-a-naked-domain-in-godaddy

2
  • Most registrars, including GoDaddy, don't allow CNAME records for the naked domain, but instead give the option to forward the user if they access the naked domain to another subdomain (such as www). I found that there can be a slight performance hit with this, so to get around it, I signed up for Cloudflare's free account and through their DNS management, you can set up a CNAME record for the naked domain. Hope this helps someone! Commented Jun 18, 2015 at 16:36
  • This answer is currently WRONG and should be updated: tachyonstemplates.com/2018/google-domains-forward-root Commented Mar 23, 2018 at 16:23
1

This is the only thing that worked for me as pointed out by Rod Michael Perez.

https://support.google.com/a/answer/2518373?hl=en

In short, you can Change how the naked domain is redirected by going to your Google Admin Console > Domains > Add/remove domains. Then for the specific domain use the "change redirect link" to redirect the naked domain. For example you can use "www". Be sure to press "Save changes" for it to take effect.

If you only have one domain the following link might help.

https://admin.google.com/DomainSettingsChangeNakedRedirect

Now you must go the Domain DNS Management Console using your credentials and add an A record for "www" and point it to your IP. For some reason the naked A records that are labeled "@" must be included in the DNS Zone. Delete any existing CNAME "www" records.

Now test the redirect by using the naked domain.

I hope this saves someone the 3 to 4 hours it took me to figure this out.

0

Just make a .htaccess file:

# Rewrite EVERYTHING to the new domain
RewriteRule ^(.*)$ newDomain.ext/$1 [R=301,L]
4
  • If they've simply registered a domain (through Google Domains) do they have any "space" in which to create a .htaccess file? Is this "space" managed by Apache and provides access to mod_rewrite?
    – MrWhite
    Commented Mar 24, 2015 at 12:14
  • If it's a plain hosting, they'll allow htaccess. I can't imagine they'd block it, even basic stuff like nice urls are impossible otherwise.
    – Martijn
    Commented Mar 24, 2015 at 12:28
  • @Martin, I am not looking to redirect users to a new domain. I want people to be able to type in example.com/123 and for that not to forward to example.com. HTACCESS doesn't really help here, since the path is being dropped. To add a little color here, this domain will be used as a link shortener (e.g. bit.ly), so forcing users to type in anything other than the naked domain is counter-productive. Any opinions from someone that has used Google Domains would be much appreciated. Commented Mar 24, 2015 at 13:16
  • You might want to clarify this in your question. And the path isnt dropped in my example, the $1 has the value. You can tweak it more to your preferences. But again, I suggest you add some examples to your question then
    – Martijn
    Commented Mar 24, 2015 at 14:01
0

Under the domains dashboard, you can set how your naked domain is treated and you can redirect the naked domain to the page that you want.

You can check out the step-by-step details here: https://support.google.com/a/answer/2518373?hl=en

There are also options under subdomain forwarding that you can use. First, you add the CNAME to your list of synthetic records. Then, select a 'Subdomain forward' from the list of synthetic records that you have. In this case, you want to choose the CNAME you just added. You can add and edit synthetic records as needed as well. Turn on path forwarding, and other options.

You can check out the details here: https://support.google.com/domains/answer/6072198?hl=en

0

Google support helped me.

Add cname for www Add synthetic record @ to http://www.yourgoogledomain.com (change yourgoogledomain to your domain)

Works like a charm.

1
  • 1
    That answer did not make a lot of sense. How about a little more than a run-on-sentence and bits that don't read like english? Commented Sep 20, 2017 at 2:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.