What Is A CNAME Record?

A CNAME record allows you to point a subdomain to another hostname. You can use this feature to create a subdomain for your site, or even redirect users to other pages on your website. This is useful if you want to direct traffic to a different page than the default landing page.

What Is A CNAME Record

What Is A CNAME Record?

A CNAME record points to another domain name. In order to make sure that the CNAME record still works even when the IP address changes, the DNS server must be updated.

You should always use the canonical domain when linking to your website. To do this, you’d create a CNAME record that points www.mydomain.com to mydomain.com. Also, you’d need to create another CNAME record that points mydomain.com to mywebsite.com.

A CNAME record is used when you want to point foo.example.com to bar.example.com but you want to avoid having to type out the full domain name every time you reference the site. Instead, you use the short form of the hostname.

A CNAME record may be used to provide additional information about a domain. In this case, the CNAME record provides information about the canonical name for example.com.

This allows clients to resolve the hostname bar.example.com to the same IP address as foo.example.com, but without having to make another DNS query.

Should I Use CNAME Record Instead Of An Alias?

Aliases are similar to CNAME records but have some differences. Aliases allow you to link two separate domains together without creating a new subdomain.

For example, you could create an alias called “www” that links to your main domain. If you wanted to change the URL to something else, you would only need to update one record instead of two.

What Is The Difference Between CNAME Records And Aliases?

CNAME records and aliases both point to another domain. However, there are some important differences between them.

Aliases are created using the same syntax as CNAME records. For example, if you wanted to create an alias named “www”, you would create a CNAME record pointing to your main domain like so:

www.example.com CNAME example.com

Aliases also work just like CNAME records. The difference is that aliases don’t require any additional configuration. All you have to do is create an alias and set its value equal to the original domain.

A CNAME record is used when you want to point a domain name to another domain name.

For example, if you wanted to point the domain name www.example.com to the domain name example.com, you’d use a CNAME record. You could also do this with an alias, but using a CNAME record makes things easier.

Can A CNAME Record Point To A CNAME Record?

Domain name pointing to other domains by using CNAME records is a bad idea. It takes time and resources to load the domain. This makes the user experience slower.

CNAME is not recommended for this use case because it causes additional steps in the DNS lookup process. Instead, use CNAME records for both www.example.com and blog.example.com to point directly to example.org.

Setting Up Separate Hostnames

You can set up an FTP CNAME record by creating a new A record for the name of the service you’re trying to access (in this case, mail).

You can enter the full hostnames or abbreviations.

Pointing Addresses Towards A “Main” Domain

You can use CNAME records to redirect traffic from one subdomain to another. This allows you to create a single website that appears under several different URLs.

However, you must make sure that you configure the CNAME correctly. A root domain (such as yourdomain.com) needs to be redirected to an IP address.

Using this same approach, you could map an entire domain to a root URL. We’ll show you how to do it using the rewrite command.

How To Add CNAME Records For Your Domain

You’ll need to add a CNAME record pointing www.example.com to example.com.

For example, on Namecheap, you can add multiple A records within the Advanced DNS tab. These records map your canonical domain towards your website’s IP address.

Add a new record by clicking on the + button. Select CNAME record type. Enter www as the host name. Then enter the target URL. Set the TTL to 1 hour.

For now, leaving this setting to automatic is likely the best option. DNS records usually update fast enough for you not to need to change this.

For now, save your new record, which appears under its A sibling. Keep in mind that you may set up multiple CNAMEs depending on your needs. You’ve already seen how to create multiple CNAMEs in the previous section.

You can’t point the same domain name to different domains. For example, you can’t point www.yourdomain.org to yourdomain.com and then alternatedomain.com. If you’re creating a new website, you’ll usually only need to create two DNS records: an A record and a CNAME record.

CNAME Record Restrictions

A CNAME cannot be placed into the root zone, because the root zone is the DNS SOA which must point to an IP address. CNAME records should point to another domain name and not an IP address.

Hostnames defined in a CNAME should have no other resource records except for DNSSEC RRs like RRSIG and NSEC. CNAME records should not point to other CNAME records.

MX and NS records should always point to an A or AAAA record, not a CNAME record. This ensures that the domain name is resolved when sending email.

What Is DNS?

DNS stands for Domain Name System. It’s a system of computers and servers that store information about websites and their associated domains.

When someone types in a URL into their browser, they’re actually asking their computer to find out what type of web content it has. A DNS server will then look up the requested information and return it back to the user.

How Does DNS Work?

The DNS system consists of three parts: authoritative DNS servers, recursive DNS servers, and resolvers.

uthoritative DNS servers are responsible for storing all the information about websites and their corresponding domains. Recursive DNS servers are responsible for looking up the information from authoritative DNS servers.

Resolvers are used by clients to connect with authoritative DNS servers.

Conclusion

CNAME records are used to point different domains to each other instead of pointing them to an IP address. This allows you to set up your own domain name for services such as FTP and email. |Hopefully we’ve helped you learn about them!

Matthew Jacobs
Latest posts by Matthew Jacobs (see all)