A DNS hierarchy is a system used to sort the parts of a domain according to their importance.
In www.codesweetly.com
, for instance, the DNS Hierarchy tree would be as shown below.
Let’s discuss each part of the DNS Hierarchy tree.
The root-level domain (“”
) is the highest hierarchy level of any domain name system.
In other words, the root-level domain is the primary directory where all other directories reside. It is the parent folder of the top-level domain and all its contents.
Keep in mind that the root-level domain does not have a name. Technically, its name is an empty string (“”
).
The top-level domain (TLD) is what follows the domain name in a URL.
For instance, in codesweetly.com
, com
is the top-level domain.
TLD’s initial purpose is to help classify websites based on their purposes, ownership, or geographical origin.
In other words, the initial intent for each TLD is like so:
However, IANA has abandoned the restrictions on most TLDs due to the exponential growth of the internet. Only a few – like “edu”, “gov”, and “mil” – remain restricted for educational, governmental, and military purposes.
A domain name (second-level domain) is your website’s name. It is the name you buy from a domain registrar like Namecheap.
In other words, a domain name is a text that comes after the subdomain.
In www.codesweetly.com
, codesweetly
is the domain name.
A subdomain (third-level domain) is a subset of a specific website. It allows you to categorize your website into one or more sections.
Although most people use www
as the main section of their website, you are technically free to categorize your domain as you wish.
So, for instance, suppose we intend to group codesweetly.com
into five categories:
In that case, our site’s five sections could look like so:
www.codesweetly.com
news.codesweetly.com
shop.codesweetly.com
forum.codesweetly.com
projects.codesweetly.com
Keep in mind that the subdomains in the five sections above are: www
, news
, shop
, forum
, and projects
.
Now, suppose our domain does not contain a subdomain. In that case, the domain would be called a base, apex, bare, root apex, naked, or zone apex domain.
So, for instance, codesweetly.com
is CodeSweetly’s apex domain.
However, we’ve configured the bare domain to redirect to the www
subdomain.
Therefore, if you enter codesweetly.com
in your browser, the computer will redirect you to www.codesweetly.com
.
Note:
You may have observed that we discussed the DNS hierarchy tree from right to left. We did so because a domain’s hierarchy descends from the right to the left.
The URL
www.codesweetly.com
is a fully qualified domain name (FQDN) because it contains all four levels of the DNS hierarchy. In other words, it has a root-level domain, top-level domain, domain name, and subdomain.Each dot mark (
.
) in a URL serves as a separator between each DNS hierarchy level. So, for instance, inwww.codesweetly
, the dot mark helps separate the domain name from the subdomain.