Answer:
This article explains what a CNAME record is and when it should be used. A CNAME record points one domain name to another domain name.
1. What Is a CNAME Record?
A CNAME (Canonical Name) record makes one domain name an alias of another.
When a CNAME is created, the subdomain points to a different domain rather than an IP address.
Example:
www.yourdomain.com
→ yourdomain.com
cdn.yourdomain.com → mycdn.provider.com
A CNAME does not contain an IP address; it only redirects to another domain name.
2. When Should You Use a CNAME Record?
You should use a CNAME record in the following situations:
-
When you want the "www" version of your domain to point to your root domain
www.yourdomain.com
-
→ yourdomain.com
-
When using a CDN service
cdn.yourdomain.com → cdn.provider.com -
When connecting external services that require a subdomain
mail.yourdomain.com → service.mailprovider.com -
When directing subdomains to a central target
CNAME records are ideal for managing multiple subdomains that share the same endpoint.
3. When Should You Not Use a CNAME Record?
Avoid using CNAME records in these cases:
-
A CNAME cannot be used for the root domain (yourdomain.com).
-
You cannot have both a CNAME and an A record for the same hostname.
-
CNAME records cannot be used for MX or NS entries.
4. Example of Creating a CNAME Record
Name: www
Type: CNAME
Value: yourdomain.com
Another example:
Name: blog
Type: CNAME
Value: sites.customprovider.com
5. Advantages of Using a CNAME Record
-
Easy to maintain; if the target domain changes, the CNAME follows automatically.
-
Useful for pointing many subdomains to a single target.
-
Commonly used when integrating external services.