A CNAME record links one domain name to another, letting an alias resolve through its canonical name to an IP address. It’s commonly used for www subdomains and CDN hosts, while A records point directly to IPs. CNAMEs also have limits, especially at a domain’s apex.

Multiple Choice

Which DNS record maps one domain to another as an alias?

A DNS alias is created with a CNAME record, which maps one domain name to another domain name. This makes the first name an alias of the second, so queries for the alias are redirected to the canonical name and then resolved to an IP address. For example, you can set a CNAME so that www.example.com points to example.com (or to a CDN host). This is different from an A record, which directly maps a name to an IP address. TXT records store arbitrary text, often for verification, while MX records specify mail servers for a domain. Remember that you usually can’t attach other records to the same name as a CNAME, and apex domains have special considerations. But the essential idea is that a CNAME provides an alias from one domain to another.

CNAME Records: How DNS Aliases Work—and Why They Matter for Security

A website can be known by more than one name. A business might use www.example.com for its public site while hosting the service on a content delivery network (CDN) with a different domain name. A CNAME record lets the first name act as an alias for the second. It’s a small piece of DNS data, but it plays a useful role in keeping web services flexible and manageable.

DNS, or the Domain Name System, is often described as the internet’s address book. When someone enters a domain name in a browser, DNS helps find the network address associated with that name. CNAME records add a layer to this lookup: instead of giving an IP address directly, they point one domain name to another.

What a CNAME actually does

CNAME stands for Canonical Name. The canonical name is the main, or official, name that another name refers to.

For example, a DNS zone might include this record:


www.example.com.  CNAME  example.com.

This says that www.example.com is an alias for example.com. When a resolver looks up the www name, it finds the CNAME and then looks up the target name to find the address information. That final lookup might return an A record with an IPv4 address, an AAAA record with an IPv6 address, or another relevant DNS record.

The distinction matters: a CNAME does not itself contain an IP address. It points to another name, and DNS follows that name to find the information needed. Think of it like a forwarding address. The alias tells the resolver where to look next; it doesn’t describe the final destination by itself.

A CNAME also doesn’t send a visitor from one web page to another. It works at the DNS level, before a browser connects to a web server. If a site owner wants the browser’s address bar to change from one URL to another, that usually requires an HTTP redirect, such as a 301 or 302 response. DNS aliasing and web redirects can support similar goals, but they’re different tools.

CNAME compared with other common records

DNS has several record types, each with a different job. Knowing the difference makes it easier to understand what a CNAME can—and can’t—do.

  • A record: Maps a domain name directly to an IPv4 address.

  • AAAA record: Maps a domain name directly to an IPv6 address.

  • MX record: Identifies mail servers that receive email for a domain.

  • TXT record: Stores text data, often used for domain verification and email security policies.

  • CNAME record: Makes one domain name an alias for another domain name.

Say shop.example.com is hosted by a third-party platform. The platform may provide a target such as store.vendor.net. A CNAME can point shop.example.com to that target. If the vendor changes the IP addresses behind its service, the domain owner may not need to update an IP address manually. The vendor can manage the target name’s address records, while the customer keeps the same alias.

That flexibility is handy, but it comes with an important rule.

The one-name rule—and the apex complication

In standard DNS, a name with a CNAME record generally can’t have other record types at that same name. For instance, if shop.example.com is a CNAME, it shouldn’t also have an A record or MX record there. The CNAME says, in effect, “use this other name as the source of the DNS information,” so conflicting records at the alias name would create ambiguity.

There’s a second wrinkle: the zone apex, also called the root of a DNS zone. For example.com, the apex is example.com itself—not www.example.com.

A CNAME is generally not allowed at a zone apex because that name already needs to hold essential records, such as NS records that identify the zone’s authoritative name servers. Some DNS providers offer features labeled ALIAS, ANAME, or “CNAME flattening.” These can provide similar results while returning address records to DNS clients. They’re provider-specific features, though, not standard CNAME records in the usual DNS sense.

So when a service asks a site owner to point a domain at a hostname, it’s worth checking whether the instruction applies to www, another subdomain, or the apex. That tiny detail can save a frustrating round of configuration changes.

Why security teams pay attention to aliases

CNAME records are routine, but routine doesn’t mean irrelevant to security. A major risk is a dangling CNAME. This happens when a domain points to a service that has been removed or is no longer claimed by its owner.

Imagine oldsite.example.com points to a hosting platform account that the organization has shut down. If the DNS record remains but the target service is released, someone else might be able to claim that resource on the platform. Depending on the provider and service, they could then host content under the organization’s subdomain. This kind of issue is often called subdomain takeover.

The risk isn’t limited to old websites. It can involve forgotten campaign pages, cloud storage, app hosting, or temporary services that were set up for a short project and then abandoned. The record may look harmless in a DNS list, while the service behind it has quietly disappeared.

Good DNS hygiene helps reduce that exposure. Organizations can keep an inventory of their subdomains, check that each CNAME target is still active and under their control, and remove records tied to retired services. Changes should also be tracked, especially when several teams or outside providers manage different parts of a domain.

CNAMEs, CDNs, and changing infrastructure

CNAME records are common in content delivery networks and hosted platforms. A CDN may route visitors to a nearby server, balance traffic, or respond to changes in network conditions. The customer’s domain can point to a provider-controlled hostname, while the provider manages the underlying address records.

That arrangement can make infrastructure changes less visible to the domain owner. It can also create a dependency: if the provider’s target name is wrong, unavailable, or no longer associated with the service, the customer’s alias won’t lead visitors where they expect. A CNAME is only as useful as the target it names.

DNS caching adds another piece to the picture. Resolvers may keep answers for a period set by the record’s time to live, or TTL. If a CNAME target changes, some users may still see cached information until it expires. That’s normal DNS behavior, not necessarily a sign of a broken configuration.

For security work, it helps to view a CNAME as a link in a chain. The alias points to a target; the target may then resolve to an IP address or another service. Reviewing only the first record can miss what the name ultimately connects to.

A simple way to read the record

When looking at a DNS zone, ask three questions:

  1. Which name is the alias? This is the owner name, such as www.example.com.

  2. What is its canonical target? This is the domain name listed in the CNAME record.

  3. Does the target still belong to an active, trusted service? If not, investigate before leaving the alias in place.

For example, a CNAME from www.example.com to example.com may be part of a straightforward website setup. A CNAME from events.example.com to a vendor’s platform may support a hosted event page. In both cases, the record doesn’t tell the whole story; the target and the service behind it matter too.

CNAME records make DNS easier to manage by letting one name refer to another. They don’t replace A or AAAA records, and they don’t perform browser redirects. Their value lies in that simple, precise role: create an alias, then let DNS resolve the canonical name. Once that distinction is clear, it becomes easier to configure domains correctly—and to spot the forgotten aliases that can turn into security problems.