DocumentationDNS & Resolution

What is a Subdomain? DNS Hierarchy Explained

An educational guide on the structure of URLs, how subdomains are delegated via DNS, and their use in organizing large applications.

Key Takeaways

  • A subdomain is an extension placed in front of your root domain name.
  • They act as completely separate websites from a technical routing perspective.
  • Subdomains require their own distinct DNS records to function.

Understanding URL Hierarchy

The Domain Name System is strictly hierarchical, read from right to left. In the URL api.example.com, .com is the Top Level Domain (TLD), example is the Second Level Domain (SLD), and api is the Subdomain.

Technical Separation

From the perspective of a DNS resolver or a web server, example.com and api.example.com are entirely different entities. You can host your main website on an Apache server in New York, while simultaneously hosting your subdomain on a Node.js cluster in London. They share nothing but the root domain name.

Configuring Subdomains in DNS

To create a subdomain, you do not need to register a new domain name. You simply add a new DNS record (usually an A Record or CNAME) in your authoritative DNS zone file, pointing the specific prefix (e.g., blog) to the desired IP address.

Frequently Asked Questions

Is 'www' a subdomain?

Yes! Technically, 'www' is just a standard subdomain. However, most websites configure their DNS and web servers to automatically redirect traffic between the naked root domain (example.com) and the 'www' subdomain so they appear identical to users.

Supported By

Sponsor Banner