Skip to content
Cloudzyro
Domains and DNS

What is a subdomain? Examples, uses and how to set one up

Kofi Agyem

, Founder and CEO, CloudzyroPublished · 5 min read

On this page
  1. 1. The short answer
  2. 2. Examples you've seen
  3. 3. What subdomains are good for
  4. 4. Subdomain vs subfolder
  5. 5. How to create a subdomain
  6. 6. Subdomains and HTTPS certificates
  7. 7. A worked example
  8. 8. Wildcard subdomains
  9. 9. Common mistakes
  10. 10. How to check a subdomain
  11. 11. Further reading

A subdomain is a name in front of your domain, like blog.example.com. What they're for, subdomain vs subfolder, the DNS records to add and how to check.

1. The short answer

A subdomain is an extra name in front of your domain, like `blog.example.com` or `shop.example.com`. It's part of the domain you already own, it's free to create, and it can point to a completely different website or server from your main site. You make one by adding a DNS record for it.

Domains are read from right to left: in blog.example.com, .com is the ending, example is the name you registered, and blog is the subdomain. See What is a domain name? for the full picture.

2. Examples you've seen

  • www.example.com: the most common subdomain of all.
  • blog.example.com, shop.example.com, help.example.com: sections run on separate tools.
  • app.example.com or dashboard.example.com: the signed-in part of a product.
  • mail.example.com: often the mail server.
  • uk.example.com, de.example.com: regional versions.
  • staging.example.com: a test copy before changes go live.

Subdomains can be nested, like api.eu.example.com. Every site on Cloudzyro Sites & Apps also gets a free subdomain of ours, like mybakery.cloudzyro.app, which keeps working after you add your own domain.

3. What subdomains are good for

  • Running different software side by side. Your main site on one platform, your shop on a store builder, your docs somewhere else.
  • Separating an app from the marketing site, so each can be deployed on its own.
  • Testing. Put a staging copy at staging.example.com.
  • Isolation. Browsers keep many things, like local storage, separate per host name, which helps keep areas with other people's content apart from your main site.

4. Subdomain vs subfolder

The alternative is a subfolder (also called a subdirectory): example.com/blog instead of blog.example.com.

  • Subfolder: one site, one host, one set of DNS records. Simpler to run, and everything sits under one domain in search.
  • Subdomain: its own records, so it can live anywhere. Better when the content runs on different software or is managed by a different team.

Google has said its systems handle both. Choose based on how the content is built and run. If everything comes from one app, a subfolder is usually simpler.

5. How to create a subdomain

Add a DNS record for the subdomain wherever your domain's DNS is managed (find out with dig +short NS example.com). The record type depends on what your host asks for:

  • CNAME to a name your host gives you. Most modern hosts prefer this. See A record vs CNAME.
  • A record to an IP address your host gives you.

For example, to put a site hosted on Cloudzyro Sites & Apps at blog.example.com:

  1. In the console, open the site's Domains tab and add blog.example.com.
  2. At your DNS provider, add the record below. Some providers want the full name, blog.example.com, instead of blog.
  3. If your DNS is at Cloudflare, set the record to DNS only (the gray cloud).
  4. Wait a few minutes. The domain goes from Waiting for DNS to Getting the certificate, then Live, and the HTTPS certificate is set up for you.
Type   Name   Target
CNAME  blog   domains.cloudzyro.app

On cPanel hosting, such as Cloudzyro Web Hosting, you create the subdomain in cPanel under Domains, which also creates its folder, and its DNS record when the domain uses the hosting's nameservers.

More detail in the docs: Connect a custom domain.

6. Subdomains and HTTPS certificates

Every name visitors use needs to be covered by an HTTPS certificate, or browsers show a warning. A certificate for www.example.com doesn't cover blog.example.com. There are two ways to cover subdomains:

  • One certificate per name. Hosts that issue certificates automatically, like Let's Encrypt-based hosts, usually do this for each name you add. Nothing for you to do.
  • A wildcard certificate for *.example.com, which covers every name one level down (blog.example.com, but not api.eu.example.com).

On Cloudzyro, the certificate for each domain or subdomain you add is set up and renewed for you. If your domain has CAA records, they must allow letsencrypt.org, pki.goog and ssl.com.

7. A worked example

Leo runs a design studio. His main site is on cPanel hosting at www.leostudio.com, and he's built a client portal with an AI tool that he wants at portal.leostudio.com on Cloudzyro Sites & Apps.

  1. He deploys the portal. It goes live at a free address, leo-portal.cloudzyro.app, so he can check it first.
  2. On the site's Domains tab he adds portal.leostudio.com.
  3. He finds his DNS is at his registrar (dig +short NS leostudio.com) and adds a CNAME for portal pointing to domains.cloudzyro.app.
  4. A few minutes later the domain shows Live with a certificate.

His main site, his email and their records are untouched: only the one new name points somewhere new. That's the main appeal of subdomains: each one is independent.

8. Wildcard subdomains

A wildcard record, *.example.com, answers for every subdomain that doesn't have its own record. Platforms use them to give every customer an address. For most sites you don't need one, and it can hide typos by making every made-up name resolve.

9. Common mistakes

  • A CNAME next to another record. A name with a CNAME can't have any other record, so remove any old A record on that subdomain first.
  • The domain added twice. Entering blog.example.com as the name at a provider that adds the domain itself gives blog.example.com.example.com.
  • Editing records where the nameservers don't point. Check the NS records first.
  • Cookies shared too widely. A cookie set for the whole of example.com is sent to every subdomain. Keep login cookies on the exact host that needs them.
  • Forgotten subdomains. A subdomain left pointing at a service you've canceled can sometimes be claimed by someone else on that service. Delete records you no longer use.

10. How to check a subdomain

# What does the subdomain point to?
dig +short blog.example.com

# Just the CNAME, if it has one
dig +short CNAME blog.example.com

# Windows
nslookup blog.example.com

If it returns nothing, the record isn't there yet or is at the wrong provider. If it returns an old value, wait for the TTL to pass (see What is DNS?). For a Cloudzyro site, the Domains tab says what it found, and the domain troubleshooting guide explains each message.

11. Further reading

Questions

Is www a subdomain?
Technically yes. www.example.com is a subdomain of example.com. It's just such a common one that most people think of it as part of the main address.
Do subdomains cost extra?
No. Once you own a domain you can create as many subdomains as you like, free, by adding DNS records.
Is a subdomain or a subfolder better for SEO?
Google has said it handles both well. A subfolder keeps everything on one site, which is simpler. A subdomain makes sense when the content runs separately, like a shop or an app on another platform.
Can a subdomain point to a different host than my main site?
Yes. Each subdomain has its own DNS records, so blog.example.com can be on one host and www.example.com on another.
Do I need a separate SSL certificate for a subdomain?
Each name needs to be covered by a certificate, either its own or a wildcard. Many hosts, including Cloudzyro, get one automatically when you add the subdomain.
How many subdomains can I have?
DNS itself sets no practical limit. Your DNS provider or host may set its own: a Cloudzyro site can have 5 domains on the Launch plan and 20 on Boost.

Put your site online free

From your AI tool, Git or a zip, with every version kept.