Let us see how to add CNAME for root domains, i.e. yourdomain.com if your domain registrar does not allow this setup. Cloudflare allows setting up CNAME for the root domains as well.
Important:
We are using yourdomain.com as a domain and server.ucartz.com as server’s/node’s Hostname in the guide for demonstration purposes.
Steps:
We assume that you alraedy have Cloudflare Account with Domain added that with the Account.
1. Log in to the Cloudflare account.
2. From the list of domains and choose the domain for which you want to setup CNAME for the root domain.
3. Now, press on DNS Tab where you will see all the existing DNS records for the particular domain.
4. Remove the DNS A record for root domain i.e. yourdomain.com in our case.
Note: Deleting the A record will pop up a warning, but nothing to worry. You have to delete the A record since you’re about to add a CNAME at root pointing to your Server’s Hostname.
5. Now, add the Following DNS CNAME Records
Type: CNAME
Name: @
Value: server.ucartz.com
TTL: Automatic
Cloud: Orange
Here ‘@’ automatically changes to root domain i.e. yourdomain.com on saving the CNAME Record.
6. Similarly, add CNAME record for www as well which will act as www.yourdomain.com for your domain.
Type: CNAME
Name: www
Value: @
TTL: Automatic
Cloud: Orange
Here ‘@’ automatically changes to root domain i.e. yourdomain.com on saving the CNAME Record which means www CNAME Record will share value from the root domain.
7. If you are using the same web server to send and receive emails then add/modify the MX and TXT Records. If you are using any 3rd Party Mail Server like GSuite, Zoho, Yandex, Amazon SES, etc then you don’t have to make the below changes as they will remain same as provided by your Mail Server Admins.
Type: MX
Name: @
Server Value: yourdomain.com
Server Priority: 1
TTL: Automatic
Type: TXT
Name: @
Value: v=spf1 a:server.ucartz.com ~all
TTL: Automatic
8. Once done now you can save the DNS Records.
Done, you have completed setting up CNAME for root domain using Cloudflare.