Subdomains
- id: 1734613741
- Date: Feb. 15, 2025, 5:18 p.m.
- Author:
- Goals
- Describe subdomains.
- Skillfully use them when you create websites.
Subdomains (What)
A subdomain is an extension of a main domain name that allows Developers to organize different sections of their website under the same primary domain.
Examples:
maps.google.com
maps is subdomain of google.com.jokes.don-elger.com
jokes is a subdomain of don-elger.com
The syntax is
subdomain-name.main-domain-name.top-level-domain-name
Notice
that the pattern is from specific to general.
Key Features of a Subdomain
Hierarchy: A subdomain comes before your main domain name. It’s separated by a period (.).
Independent Sections: Subdomains can function as separate sections of your site, allowing you to host different content, applications, or services.
Custom Use: You can set up multiple subdomains for various purposes, like:
- blog.don-elger.com for a blog.
- store.don-elger.com for an online store.
- jokes.don-elger.com for your dad-joke app.
Why Use Subdomains?
Organization: They help keep content organized, especially if your site offers diverse services.
Different Applications: Subdomains can point to entirely separate servers or apps (e.g., a Flask app on Heroku).
SEO Benefits: They can target specific audiences or regions without affecting your main site’s SEO.
Custom Branding: Subdomains allow unique URLs that make services or sections stand out.
How Subdomains Work in DNS
A subdomain is configured in your domain’s DNS settings: * A CNAME
record (or sometimes an A record) tells web browsers where to find the
content for the subdomain. * For example,
jokes.don-elger.com
can point to a Heroku app using a
CNAME.