How to add a CNAME record for a subdomain
Objective
A CNAME record is used to associate a subdomain with a domain name or subdomain, without having to specify an IP address. This means that the subdomain will be redirected to the target domain name or subdomain’s IP address, without requiring any additional configuration.
For example, if you create a CNAME record for www.domain.tld that points to domain.tld, then www.domain.tld will use the same IP address as domain.tld.
CNAME records are useful for avoiding changing IP addresses for your subdomains. They can also be used to configure services such as email servers.
Find out how to add a CNAME record to your OVHcloud DNS zone.
Do you already have a CNAME record in your DNS zone? Follow our guide on Editing an OVHcloud DNS zone.
Requirements
- A domain name
- A DNS zone associated with this domain name at OVHcloud
- Access to the OVHcloud Control Panel, in the
Web Cloudsection
Adding, modifying or deleting DNS records in an active DNS zone is a tricky task. If in doubt, contact a specialist provider.
Instructions
Add a DNS record of type CNAME for a domain name subdomain
- Click the
DNS zonesmenu, then choose the domain name concerned. - On the page that appears, click
Add an entry. - In the window that opens, select the field of type
CNAME. - Then enter in the
Sub-domainfield the subdomain concerned (for example:wwwfor the subdomainwww.domain.tld), and in theTarget *field, the domain name or subdomain (for example:domain.tld) that you want to target using the CNAME record type. Finally, clickNext. - Check the summary, then click
Confirm. It takes up to 24 hours for the change to propagate fully over the DNS network.
See our detailed guides:
Special cases
Click on the links below for more information:
CNAME and TXT records for the same subdomain
Do not configure both a CNAME record and a TXT record for the same subdomain. This can cause random results during DNS resolution, as only one response can be returned per DNS query.
For example, if you have the following records for www.domain.tld:
- A CNAME record pointing to domain.tld
- A TXT record with a specific value
A DNS query for www.domain.tld will return either the target of the CNAME record or the value of the TXT record, at random.
CNAME on a domain name in its own DNS zone
By convention, CNAME records cannot be used on a domain name in its own DNS zone. The domain name must point directly to an IP address with a record of type A for an IPv4, or AAAA for an IPv6.
As an example, you will not be able to create a CNAME record for the domain name domain.tld in the DNS zone you have created for it.
However, you can create CNAME records for all subdomains (e.g. subdomain.domain.tld or www.domain.tld) of the domain.tld domain name in the DNS zone created for domain.tld.
Go further
For specialised services (SEO, development, etc.), contact OVHcloud partners.
If you would like assistance using and configuring your OVHcloud solutions, please refer to our support offers.
Join our community of users.