How to Add a CNAME Record

Updated 25 February 2026 12 views DNS & Nameservers

Adding a CNAME Record

A CNAME (Canonical Name) record creates an alias that points one domain name to another. Instead of mapping directly to an IP address, a CNAME points to another domain which then resolves to the IP address.

When to Use a CNAME Record

  • Pointing www.yourdomain.com to yourdomain.com.
  • Connecting subdomains to third-party services (e.g., shop.yourdomain.com to Shopify or blog.yourdomain.com to WordPress.com).
  • Domain verification for services like Google Workspace or Microsoft 365.
  • Setting up CDN services that require a CNAME.

How to Add a CNAME in DirectAdmin

  1. Log in to DirectAdmin and go to DNS Management.
  2. Select your domain and click Add Record.
  3. Set the Type to CNAME.
  4. In the Name field, enter the subdomain (e.g., www or shop).
  5. In the Value field, enter the target domain name (e.g., yourdomain.com. or shops.myshopify.com.). Note the trailing dot which indicates a fully qualified domain name.
  6. Set the TTL and click Save.

How to Add a CNAME in Cloudflare

  1. Log in to Cloudflare, select your domain, and go to DNS > Records.
  2. Click Add record and select CNAME.
  3. Enter the Name (subdomain) and Target (destination domain).
  4. Choose proxy status (orange cloud for proxied, grey cloud for DNS only).
  5. Click Save.

Important Rules

  • A CNAME record cannot coexist with other record types for the same name. For example, you cannot have both a CNAME and an MX record for the root domain.
  • The root domain (@) typically cannot use a CNAME record (use an A record instead). Cloudflare supports CNAME flattening which works around this limitation.
  • CNAME records add a slight lookup overhead since the DNS resolver must perform an additional query.

Was this article helpful?

Let us know so we can improve our docs.