How to Add a CNAME record to your DNS settings

DNS

Managing DNS (Domain Name System) settings is a critical aspect of maintaining your website’s online presence. One essential DNS record you might need to add is a CNAME (Canonical Name) record. CNAME records are particularly useful for redirecting domain names to another domain without affecting the original domain’s settings. This article will guide you through adding a CNAME record to your DNS settings, explaining the concept, its use cases, and step-by-step instructions for popular DNS providers.

What is a CNAME Record?

A CNAME record is a type of DNS record that maps an alias name to a true or canonical domain name. This is particularly useful when you want multiple domain names to point to the same website or when you want to ensure that your domain name points to the correct IP address even if the original IP address changes.

For example, if you have a domain like www.yourwebsite.com, you can use a CNAME record to point it to another domain, such as yourwebsite.com, without having to update the IP address whenever it changes. This makes it easier to manage multiple domain names and ensures consistency across your web presence.

Common Use Cases for CNAME Records

Pointing Subdomains to the Main Domain: You can use a CNAME record to point subdomains (like blog.yourwebsite.com or shop.yourwebsite.com) to your main domain (yourwebsite.com). This is helpful when you want to maintain separate sections of your site but keep everything under one primary domain.

Using Branded URLs: Many businesses use CNAME records to create branded URLs for services hosted by third-party providers. For example, you could set up a CNAME record for support.yourwebsite.com that points to a third-party helpdesk provider.

Setting Up CDN or Cloud Services: Content Delivery Networks (CDNs) or cloud services often require CNAME records to direct traffic from your domain to their infrastructure, improving site performance and availability.

Preparing to Add a CNAME Record

Before adding a CNAME record, make sure you have the following information:

Alias Name: The subdomain or alias you want to create (e.g., www, blog, or shop).

Canonical Name: The target domain or hostname you want the alias to point to.

DNS Hosting Provider: Access to the DNS management section of your domain registrar or DNS hosting provider.

How to Add a CNAME Record: Step-by-Step Guide

The process of adding a CNAME record varies depending on your DNS hosting provider. Below, we’ll cover how to do this with some of the most common providers, including GoDaddy, Cloudflare, and cPanel.

1. Adding a CNAME Record in GoDaddy

Step 1: Log in to Your GoDaddy Account: Navigate to GoDaddy’s website and log in with your credentials.

Step 2: Access DNS Management: Click on your profile name and select “My Products.” Under “Domains,” find the domain you want to edit and click “DNS” next to it.

Step 3: Add a CNAME Record: Scroll down to the “Records” section. Click “Add” to create a new record. Choose “CNAME” from the drop-down menu. Enter the alias name in the “Host” field (e.g., www). Enter the canonical name in the “Points to” field (e.g., yourwebsite.com). Set the TTL (Time to Live), which determines how long the record is cached, or leave it at the default setting. Click “Save.” Your CNAME record will be added, and DNS propagation usually takes a few minutes to 48 hours.

2. Adding a CNAME Record in Cloudflare

Step 1: Log in to Your Cloudflare Account: Go to Cloudflare’s website and log in.

Step 2: Select Your Domain: On the dashboard, select the domain where you want to add the CNAME record.

Step 3: Add a CNAME Record: Navigate to the “DNS” tab. Click “Add Record” and choose “CNAME” from the Type menu. In the “Name” field, enter the alias (e.g., blog). In the “Target” field, enter the canonical domain (e.g., yourwebsite.com). Click “Save.” Cloudflare’s global network should propagate your changes quickly.

3. Adding a CNAME Record in cPanel

Step 1: Log in to cPanel: Access your cPanel by logging in via your hosting provider’s portal or directly through your domain (e.g., yourwebsite.com/cpanel).

Step 2: Navigate to DNS Zone Editor: Under the “Domains” section, click on “Zone Editor.”

Step 3: Add a CNAME Record: Find the domain you want to edit and click “Manage.” Choose “Add Record” and select “CNAME.” Enter the alias in the “Name” field and the canonical name in the “CNAME” field. Click “Add Record.” Your new CNAME record should be active shortly after saving.

Best Practices for Managing CNAME Records

Avoid Using CNAME at the Root Level: CNAME records should not be used at the root level of your domain (e.g., yourwebsite.com) because it can conflict with other records like A records. Use it for subdomains instead.

Monitor DNS Propagation: After adding a CNAME record, it’s essential to monitor DNS propagation to ensure that the changes take effect globally. You can use online tools like DNSChecker to track this.

Keep Your DNS Records Organized: Regularly review and clean up your DNS records. Remove outdated or unnecessary CNAME records to prevent conflicts and ensure optimal performance.

Test Your Configuration: Before finalizing any DNS changes, test your configuration using tools like Dig or NSLookup to confirm that your CNAME record is resolving correctly.

Troubleshooting Common CNAME Issues

Incorrect Canonical Name: Double-check the target domain for typos or errors, as an incorrect canonical name will prevent the CNAME from resolving correctly.

Conflicting DNS Records: Ensure no conflicting records (e.g., A records) exist for the same alias, which can cause DNS resolution issues.

Propagation Delays: Remember that DNS changes may take time to propagate fully. Patience is key, but if you experience prolonged issues, consider contacting your DNS provider for assistance.

Conclusion

Adding a CNAME record to your DNS settings is a powerful way to manage multiple domains, subdomains, and external services efficiently. Whether you’re setting up a new subdomain, redirecting traffic, or configuring a third-party service, understanding how to use CNAME records is essential for maintaining a robust and flexible online presence. Follow the steps outlined in this guide, and you’ll have your CNAME record up and running in no time.