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.comtoyourdomain.com. - Connecting subdomains to third-party services (e.g.,
shop.yourdomain.comto Shopify orblog.yourdomain.comto 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
- Log in to DirectAdmin and go to DNS Management.
- Select your domain and click Add Record.
- Set the Type to
CNAME. - In the Name field, enter the subdomain (e.g.,
wwworshop). - In the Value field, enter the target domain name (e.g.,
yourdomain.com.orshops.myshopify.com.). Note the trailing dot which indicates a fully qualified domain name. - Set the TTL and click Save.
How to Add a CNAME in Cloudflare
- Log in to Cloudflare, select your domain, and go to DNS > Records.
- Click Add record and select CNAME.
- Enter the Name (subdomain) and Target (destination domain).
- Choose proxy status (orange cloud for proxied, grey cloud for DNS only).
- 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.