A CNAME record (Canonical Name record) is a type of DNS (Domain Name System) record used to create an alias or pointer from one domain name to another.
Allows you to associate a subdomain with the DNS information of another domain; this is used to direct traffic from one domain to another without individually changing the IP address records.
Here’s how a CNAME record works:
Suppose you have two domain names: domain1.com and domain2.com. You want to set up a subdomain “sub.domain1.com” to point to “domain2.com”.
Instead of duplicating the DNS information (like IP addresses and other records) for “sub.domain1.com”, you can create a CNAME record for it:
- Record Type: CNAME
- Host: sub
- Points to: domain2.com
Now, when someone tries to access “sub.domain1.com”, their DNS resolver will look up the CNAME record and resolve the IP address of “domain2.com”. Allowing you to manage the IP address changes or other DNS configurations for “domain2.com” in one place while associating the “sub.domain1.com” subdomain with those changes.