NodeSpell Docs
Nodes
Release Notes

Domain Basics

Chuang Niu2 years ago

Understanding the Basics of Domains

Domains are a fundamental aspect of the internet, acting as the address system for websites and online services. This article covers the basic components of domains and provides insights into their setup and usage.

The Three Parts of a URL

A URL (Uniform Resource Locator) typically consists of three main components:

  1. Subdomain: The subdomain is the optional third-level domain used to organize and navigate to different sections of a website. For example, in blog.example.com, blog is the subdomain.

  2. Apex Domain: Also known as the second-level domain, this is the core part of the URL, like example in example.com. It's often the most recognizable part of a website's address.

  3. Top-Level Domain (TLD): The TLD is the last segment of the domain name, such as .com, .org, .net, etc. It categorizes domains by purpose, owner, or geographic area.

Relationship Between Subdomain and Apex Domain

Subdomains function as extensions of the apex domain and can be used to set up distinct sections or services within the same website. For instance, shop.example.com could be the online store for the main site at example.com. Subdomains offer a way to structure a site without needing to register new domain names.

Best Practices for Redirection

Redirection is commonly used to guide visitors from one web address to another. Here are some best practices:

  • Use 301 redirects for permanent changes to ensure search engines transfer the old page's rankings to the new page.
  • Avoid redirect chains where possible. Multiple redirects can slow down page load times and complicate SEO.
  • Redirect to relevant pages: Ensure that the redirection leads to content similar to what the user expects based on the original URL.

Differences Between Subdomains and Routes

Subdomains and routes are both used to organize content but in different ways:

  • Subdomains are treated as separate entities by search engines. They can host entirely different content from the main site and might be used for a blog (blog.example.com) or a specific product (product.example.com).

  • Routes are part of the same domain and follow the main domain name in a URL. For example, example.com/blog or example.com/about. Routes are seen as part of the main website and are often used for site navigation.

The Difference Between www.example.com and example.com

While www.example.com and example.com may seem similar, they serve different purposes in the domain naming system.

  • www.example.com: The www in www.example.com is a subdomain of example.com. Historically, the www (World Wide Web) subdomain was used to explicitly indicate that the domain was part of the Web. Today, this distinction is less important as most domains are assumed to be part of the Web.

  • example.com: This is the apex or root domain and represents the domain in its simplest form. It is often used for simplicity and branding, as it's shorter and typically easier to remember.

Common Usage Practices

  • Redirection: It's common for websites to choose one format as the primary address (www or non-www) and redirect the other to it. This ensures consistency and avoids potential issues with search engine indexing.

  • Branding and Preference: Some brands prefer the www version for traditional reasons or for technical constraints, while others prefer the non-www version for simplicity and modernity.

  • Cookies and Subdomains: Cookies set at the apex domain level are accessible by all subdomains, whereas cookies set at the www subdomain are not accessible by other subdomains. This can impact web development and user experience decisions.

  • DNS Management: Some technical setups in DNS management or website hosting might favor one version over the other for flexibility or performance reasons.

Ultimately, the choice between using www.example.com and example.com depends on technical requirements, historical preferences, and branding strategies. It is important to be consistent with the chosen format and ensure proper redirection for a unified user experience.


Understanding these aspects of domains can significantly enhance your ability to structure, navigate, and optimize websites effectively. There are 3 parts inside a domain.

~