Add a CNAME record

A CNAME record is a DNS record that turns one domain (usually a subdomain) into an alias for another. To show you how it works, we’ll look at its most common application – mapping the www. subdomain to the primary domain.

First, a user enters www.domain.com into their browser. The browser sends a request to the DNS resolver and is relayed to the Authoritative Name Server that hosts domain.com’s DNS zone file. Then, the server responds with the stored CNAME record. 

The browser understands that it needs to look for domain.com and puts together a second DNS request, eventually resolving to the correct IP.

It’s important to make the distinction between a CNAME record and a redirect. A redirect reroutes the traffic to a predetermined destination. The goal of the CNAME is to lead the user to the correct IP address.

You can have a CNAME record for blog.domain.com that points to domain.com, but this doesn’t necessarily mean that the two will display the same content. 

If it is configured correctly, blog.domain.com will lead users to the server’s IP address, and the web server will serve them the blog section of your website rather than the homepage. CNAME records can be very useful in many scenarios.

For example, suppose all your subdomains (blog.domain.com, shop.domain.com, mail.domain.com, ftp.domain.com, etc.) are mapped to domain.com, and domain.com has an A record pointing it to the server’s IP.

If you ever need to move the website to a different server, all you’ll need to do is change domain.com’s A record. It will save you a lot of time reconfiguring every individual subdomain one by one.

There are a couple of restrictions you need to bear in mind when setting CNAME records:

  • You can’t place a CNAME record at the root domain level (domain.com).
  • CNAME records can only point to other domain names and never to IP addresses.
  • You can’t place a CNAME record for a hostname with other DNS records like A records, NS records, etc. (with the exception of DNSSEC records).
  • It is possible to point one CNAME record to another, but this is not considered a good practice, as it affects performance due to the increased number of DNS requests.
  • MX and NS records can’t point to CNAME aliases.
  • Domains used for email can’t act as CNAME aliases.

Setting a CNAME record on your ScalaHosting account

After you point your domain to your ScalaHosting account, our servers are responsible for hosting your DNS zone file. Both cPanel and SPanel let you edit it through an easy-to-use Graphical User Interface (GUI). Here are the exact steps.

SPanel

SPanel’s tool for editing your domain’s DNS zone is available on the User Interface homepage.

Add a CNAME record, SPanel

At the top of the page, you have a drop-down menu from which you can pick the domain you’d like to edit. At the bottom, there’s a list of all the DNS records currently set for the chosen domain. 

You should be able to see that there’s already a CNAME record for the www. subdomain that points to your primary website. It’s there by default.

Add a CNAME record, SPanel 2

Between the Choose a domain to edit drop-down and the list of existing records, you have the form for adding new DNS records.

To add a new CNAME record, you first need to enter the alias. Bear in mind that if the new alias is a subdomain of the primary domain, you only need to add the first section (i.e., if you want to create a CNAME record for blog.domain.com, you only need to enter blog in the Name field).

TTL is short for Time to Live. It’s a setting that determines how long information on the record will stay in the DNS resolver’s cache before a new request is required. By default, it’s set at 14,400 seconds or 4 hours – a good compromise between quick propagation times and decent performance.

From the Type drop-down, you need to pick CNAME.

Finally, in the Value field, you have to enter where the new CNAME record will be pointing to.

Add a CNAME record, SPanel 3

After you’re ready, you can click Add Record to save the new record. Bear in mind that changes to the domain’s DNS settings need some time to propagate throughout the world, so the modifications might not be immediately visible.

cPanel

cPanel’s DNS Zone Editor is available on the control panel’s homepage.

Add a CNAME record, cPanel

Its interface is a bit different from what SPanel offers. You have the list of all the domains you’ve added to your cPanel account, along with buttons for adding the most common DNS records.

Add a CNAME record, cPanel 2

The CNAME Record button opens up a pop-up requesting the CNAME alias and the record’s value.

Add a CNAME record, cPanel 3

After you enter the requested information, you need to click Add A CNAME Record to complete the process.

Was this helpful?

What’s your goal today?

1. Find the right Managed VPS solution

If you’re looking for industry-leading speed, ease of use and reliability Try ScalaHosting with an unconditional money-back guarantee.

2. Make your website lighting fast

We guarantee to make your WordPress site load in less than 2 seconds on a managed VPS with ScalaHosting or give your money back. Fill out the form, and we’ll be in touch.

Please enter a valid name
Please enter a valid website
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

3. Streamline your clients’ hosting experience

If you’re a web studio or development agency hosting more than 30 websites, schedule a call with Vlad, our co-founder and CTO, and see how we can deliver unmatched value to both your business and your clients.

Photo

Need a custom cluster or professional advice?

Book a meeting and get a free 30-minute consultation with Vlad, co-founder & CTO of Scala Hosting, who will help you select, design and build the right solution - from a single data center cluster to a multi-region & multi-datacenter high availability cluster with hundreds of servers.

Book a free consultation

4. Learn how to grow your website in 2024

An all-star team of SEO and web influencers are sharing their secret knowledge for the first time in years. Learn about the future of SEO, Web Design best practices and the secrets to getting the foundation for your website to thrive. Watch the exclusive webinar.

An Exclusive Insiders Look Behind The SEO and Web Development Curtain

Rado
Author

Working in the web hosting industry for over 13 years, Rado has inevitably got some insight into the industry. A digital marketer by education, Rado is always putting himself in the client's shoes, trying to see what's best for THEM first. A man of the fine detail, you can often find him spending 10+ minutes wondering over a missing comma or slightly skewed design.