What is a CNAME DNS record?
A CNAME DNS record redirects a domain or subdomain to another domain, simplifying DNS management and ensuring flexibility in configuring web services.
A CNAME (Canonical Name) DNS record is used to redirect a domain or subdomain to another domain or subdomain. This simplifies DNS management and allows flexibility in configuring web services, such as redirecting to a specific server.
For example, if we want the subdomain www.exemplu.ro to redirect to the main domain exemplu.ro, we can add the following record in the DNS zone:
www IN CNAME exemplu.ro
In this case, all requests addressed to the subdomain www
will be automatically redirected to the main domain, without requiring additional configurations.
Another common scenario is the redirection of subdomains used for email services, such as mail.example.com
, imap.example.com
, or smtp.example.com
, to the domain name of the email server. This is done by adding similar records in the DNS zone:
mail IN CNAME mailserver.example.comimap IN CNAME mailserver.example.rosmtp IN CNAME mailserver.example.ro
Using CNAME records is an effective and common practice to ensure consistency and to avoid the need to manage multiple IP addresses in DNS configurations. However, it is important to mention that CNAME records cannot be used for the root domain (for example, example.ro
), as DNS standards prohibit this practice.
If you need assistance in properly configuring the DNS records for your domain, the Hostico team is always available to help you.