Been trying to this for a few days after countless tutorials and I can’t seem to figure it out.
The desired outcome is this:
www.example.com is my main react app hosted on Google Cloud Servers.
blog.example.com is my Gatsby blog hosted on Netlify.
I have a robust react app that is hosted on
www.example.com, on a Google cloud server. The domain is registered with Google domains.
I want to add a new subdomain,
blog.example.com and have it point to Netlify, where I host a simple Gatsby blog.
Everything I find always leads me to change my apex/main domain to netlify servers, but this is not the desired outcome as it will no longer point to my main app, and the email accounts associated with it stop working as well.
I have no idea how to do it.
From my understanding, we can add an
A record on Google domains:
blog.example.com A 126.96.36.199
or add a
blog CNAME → theNetlify-app-name.netlify.app
Neither of these solutions seem to work.
You can use a CName to map your desired sub domain to your Netlify site as per their documentation:
The important thing is that both ends (Google Domains and Netlify) need to know about the new domain.
In summary you need to configure your external DNS provider to point your domain to Netlify:
On your Netlify control panel, select the "Custom domains" panel, select "Check DNS configuration" next to the custom domain to open customized details about the DNS records you need to configure.
To point a subdomain such as
blog.petsofnetlify.com to your site on Netlify, you must first create a CNAME record with your DNS provider.
For example, if your site’s domain is
blog.petsofnetlify.com and your Netlify subdomain is
blog, as the host.
Once you've completed those steps with Google Domains, you then need to complete the steps in the Netlify control panel to assign the custom domain to your site:
Select "Add custom domain" at the bottom of the "Custom domains" panel, and enter your domain name. Select "Verify".
Pressing verify will check that the DNS settings you've entered in Google Domains are correctly configured and pointing at the Netlify site - if they are, then your new domain should be configured and serving pages as expected.
Answered by Zhaph - Ben Duguid on March 8, 2021
Get help from others!