Skip to content

Configuring DNS for the Root Domain

These instructions take you through the general steps required to set up your DNS for use with a root domain such as You must be using Cloudflare DNS, if you wish to use this CNAME method with your root domain. If you would prefer to use a subdomain (e.g. or, please see Configuring DNS for a Subdomain.

These instructions are for setting up your existing DNS records with Cloudflare DNS. If you are switching to DNS, please see Using DNS.

Keep a Reference

Log into Cloudflare to edit your DNS setup. The first thing you should do, before you change anything, is to take a screenshot of your configuration. You want to have a reference in case you want to revert back.

General Instructions

While logged into Cloudflare, you will need to perform these basic steps:

  1. Adjust the TTL on your subdomain's A record to be very short while you work on it
  2. Add a new A record for a backup subdomain
  3. Add a CNAME record for any subdomain you also want to use with (OPTIONAL)
  4. Replace the A record with a flattened CNAME record that points to the domain
  5. Adjust the TTL on the flattened CNAME record back to what the original A record was

Cloudflare Instructions

For more specific instructions for editing DNS records in the Cloudflare environment, please see Cloudflare's own documentation.

Detailed Instructions

Adjust TTL

If there is an A record for your subdomain, adjust the TTL value to the smallest time period possible. This is so that you can make changes and not have to wait a long time for them to take effect.

Once the previous TTL has passed, the new TTL will take effect.


The previous value was 60 minutes and you change it to 2 minutes. If it is 3:00pm when you change the value to 2, you must wait 60 minutes before that value is effective.

Create an A Record

Create a new A record that points to your IP. You can give it any domain name that you'd like. It will serve as a back-up record in case you need to switch off. Example:

Create a CNAME Record (OPTIONAL)

If you want to also use a subdomain (like with your root domain, it needs to have a CNAME record.

  1. If there is currently an A record for the subdomain, delete it.
  2. Add a CNAME record. Set Name to your subdomain (, Value to your root domain (, and keep the TTL set to the lowest possible value.

Create an ALIAS, ANAME, or Flattened CNAME Record

  1. Delete the A record for your root domain.
  2. Create a CNAME record. Set Name to your root domain, Value the same as the backup A record you created earlier (, and keep the TTL set to the lowest possible value.

Visit your site and verify that you can still access everything properly.


At this point, all you have done is make some local changes to your own DNS. is not involved in this process. If you are having issues accessing your site, then it is not related to It is likely to be an error in your DNS configuration. Refer to the backup screenshot you took before you started.

Edit the CNAME Record

That CNAME record you added earlier now must be used to connect to Edit it and change the Value field to the domain name given to you in your Dashboard (e.g.


If you don't see a domain name, you may need to enable the CDN first. Press the Enable CDN button and check again.

Visit your site again and verify that you can still access everything properly.

If it is not accessible, review your DNS configurations and run through the steps again. Check if your TTL for the old configuration has expired. Make sure that the correct amount of time has elapsed.

Adjust TTL

Once you have verified that your site is still accessible, you are finished making changes to the DNS. You can set the TTL for any new records to something more reasonable. Use the value of the original A record, if you're not sure.

OPTIONAL: Configure a Subdomain

If you want to use a subdomain (e.g. in addition to your root domain, please follow our subdomain directions.

Next Step

Once your DNS is set up, you're ready to enable the CDN.

Last update: February 3, 2024