Skip to content Are you an AI agent? QIO facts, prices and requests are here

10 min read

What is a subdomain, when do you need one and how do you create it?

Learn what a subdomain is, how it compares with a subfolder for SEO, and how to set up DNS and SSL. We also cover mistakes that can leave forgotten subdomains vulnerable.

A chrome branch splits into several thinner branches with spheres at their ends

A subdomain is an address within your main domain that works as a separate website: blog.site.ru, shop.site.ru or spb.site.ru. You create one with a DNS record, but the decision affects SEO, analytics and security. Here is when to use a subdomain, when a subfolder may be better and how to avoid common setup mistakes.

What is a subdomain?

A subdomain is a domain at the next level within your domain. The owner of site.ru can create blog.site.ru or help.site.ru without buying or registering it separately. They add a record to DNS, the system that translates website names into server addresses. The record connects the new name to a server. To make the site available over HTTPS, you also need to configure it on the server and issue a certificate, as described below.

Read the address from right to left:

  • ru is the top-level domain or domain extension;
  • site.ru is the second-level domain you register;
  • blog.site.ru is a third-level domain, or a subdomain of the site.

Technically, www.site.ru is also a subdomain. Choose one of the two addresses as the main one and redirect the other to it.

For advice on choosing a domain and keeping it under your company's control, see our article on choosing a domain.

Subdomain or subfolder: which should you choose?

A chrome cabinet with an open drawer and a separate small cabinet beside it
A subfolder is a drawer in the same cabinet; a subdomain is a separate cabinet

If a section is an extension of the main site, such as a blog, services or catalogue, a subfolder like site.ru/blog/ is usually simpler. A subdomain makes sense when the section uses a different platform or server, or is run by a different team, making it easier to manage separately.

Search engines do not prohibit either option. Google's guidance for multi-regional sites says subdomains are easy to separate and host on different servers, while subfolders are easier to maintain because everything is on one host.

CriterionSubdomain blog.site.ruSubfolder site.ru/blog/
SetupDNS record, separate site on the server, SSL certificate covering the subdomain nameSection in the same CMS (content management system)
Platform and serverCan be differentShared with the main site
robots.txt and sitemapSeparate files for the subdomainShared
Yandex WebmasterAdded as a separate siteIncluded in the main site
Navigation and internal linksMust be linked manuallyShared menu and links
When to choose itSeparate product or platform, region with its own product range, test environmentBlog, services, articles and regional pages without separate infrastructure

The main SEO implication is that a subdomain develops as a separate site, with its own indexed pages and statistics. Links connect it to the main site. If the aim is to strengthen the main site with content, a subfolder usually achieves the same effect with less effort.

Why use subdomains? Common cases

Subdomains are useful when a section is technically or conceptually separate from the main site: regional versions, separate platforms, test environments or application services.

Regional and language versions

Large companies put cities or countries on subdomains such as spb.site.ru and en.site.ru. This makes sense if a region has its own product range, prices and team. If only addresses and telephone numbers differ, regional pages in subfolders are enough.

A blog, help centre or shop on another platform

If the blog uses one CMS and the main site another, placing the blog on a subdomain can be easier than integrating it. The same applies to a help centre, forum or shop on a cloud platform: the service gives you an address, and you connect your subdomain to it through a CNAME record.

Test environment

Teams test updates on dev.site.ru or stage.site.ru without risking the live site. Protect such a subdomain with a password. According to Google's documentation, robots.txt is not intended to remove a page from search results and does not protect it from outsiders.

Mobile version

Mobile versions used to live at addresses such as m.site.ru. Google now recommends responsive design: using one HTML page at the same address for all devices is easier to implement and maintain.

APIs and infrastructure services

Addresses such as api.site.ru, cdn.site.ru and mail.site.ru separate infrastructure for APIs, static files and email. They can be hosted on different servers and usually do not need to be indexed.

How to create a subdomain

The process depends on where the site will run. Change DNS records wherever the domain's DNS zone is managed: at the registrar, hosting company or DNS provider.

  • Your own server. Add an A record with the server's IP address, or an AAAA record for IPv6. Then configure a site for the new name in the Subdomains or Sites section of your hosting control panel. In nginx or Apache, configure a virtual host.
  • External platform. First connect the subdomain in the service's control panel. Then create a CNAME record pointing to the host name the service provides.

The remaining steps apply to both options.

  1. Wait for the record to propagate. DNS changes are not immediate and usually take from a few minutes to a day. The domain selection article linked above explains why. The record has propagated when a DNS checker shows the server IP address or external service name you specified for the new name.
  2. Issue an SSL certificate and set up a redirect from HTTP to HTTPS.
  3. Check server responses: working pages should return a 200 status code and non-existent pages a 404.

How to set up an SSL certificate

A subdomain needs an SSL certificate, an encryption certificate that lets a browser open the site over HTTPS, that includes its name. A certificate for site.ru does not protect blog.site.ru unless that name is listed separately or covered by a certificate such as *.site.ru.

  • A separate certificate for each subdomain: hosting providers often issue these automatically.
  • One certificate for several names: site.ru, www.site.ru and blog.site.ru can be included in one list.
  • A *.site.ru wildcard certificate covers all subdomains one level below site.ru, but not site.ru itself or dev.shop.site.ru. Let's Encrypt verifies control of the domain through DNS using DNS-01 for this type of certificate. When issuing *.site.ru, add a DNS text record (TXT) named _acme-challenge.site.ru with the value supplied by the issuing service. If your host manages DNS and supports automatic validation, it will add the record for you.

If the main site has HSTS enabled, a strict mode that makes browsers use HTTPS, with the includeSubDomains setting, browsers will open every subdomain over HTTPS only. A subdomain without a certificate will then be inaccessible. See our article on choosing an SSL certificate for help selecting a certificate type.

What changes for SEO and analytics?

For search engines and analytics, a subdomain is a separate host with its own robots.txt and sitemap, and separate tracking in webmaster tools.

  • robots.txt. Under Google's specification, rules apply only to the host, protocol and port where the file is located. site.ru/robots.txt does not apply to blog.site.ru.
  • Sitemap. Create a sitemap for the subdomain and list it in that subdomain's robots.txt.
  • Yandex Webmaster. In this tool from Yandex, a major Russian search engine, add the main domain and subdomain separately. Ownership of several subdomains can be verified more simply with one code.
  • Search Console. A domain property includes all subdomains and protocols and is verified through DNS. A URL-prefix property shows only one subdomain.
  • Duplicates. If the same pages are available on the subdomain and the main site, specify a canonical URL, the preferred page address for search engines, or block the copy.
  • Yandex Metrica. With separate tracking tags, a move from the domain to the subdomain looks like a visit from another site and the original traffic source is lost. If separate statistics are unnecessary, use one tag and add the subdomain to the additional site addresses.

How to find all subdomains of a site

Start with the domain's DNS zone, which holds the full list of subdomains. Other methods can help you find forgotten addresses that are still accessible.

  • DNS zone at the registrar or DNS provider: look for A, AAAA and CNAME records with subdomain names.
  • Hosting control panel: check the sites and subdomains section.
  • Certificate Transparency logs, such as crt.sh: public records of issued certificates show subdomain names.
  • Search: the site:site.ru operator shows indexed pages from the domain and its subdomains.

Each subdomain should have an owner and a purpose. Remove unnecessary DNS records, but first check where each address leads and whether operational systems such as email, APIs or external services depend on it.

Common mistakes and security risks

A ring of chrome keys and a forgotten key beside an open padlock
A forgotten DNS record can leave a subdomain open to outsiders

The main risks are forgotten DNS records, exposed test environments and shared cookies. They arise when a subdomain is created for a task and then forgotten.

  • Subdomain takeover. If a service is disconnected but its CNAME remains, an attacker may be able to create a resource with your name at the same provider and publish their own content there. MDN recommends deleting the DNS record first when disconnecting a service and creating it last when connecting one (MDN's explanation).
  • An exposed test copy can appear in search results as a duplicate of the main site.
  • Domain-wide cookies. A cookie set for site.ru with the Domain attribute is available to all subdomains. If one is compromised or given to a contractor, sessions on the main site are at risk: a cookie stores the user's login session, and someone who obtains it can log in as that user.
  • A subdomain without an owner: an outdated CMS that is not updated becomes an entry point for an attack.

If subdomains have accumulated over the years and it is no longer clear which are needed, an inventory of DNS, certificates and CMS platforms can be included in website support.

Sources

Questions and answers

How do I create a subdomain?

For your own server, add an A record with its IP address to DNS and configure the site for the subdomain name. For an external platform, first connect the subdomain in its control panel, then add a CNAME record with the host name supplied by the platform. In both cases, check the certificate and open the subdomain over HTTPS.

What is a domain in simple terms?

It is a unique website name on the internet, such as site.ru, which DNS connects to a server address. You register a domain through a registrar and renew it regularly.

How can I tell a domain from a subdomain?

Read the address from right to left: site.ru is a second-level domain, and a name to its left separated by a dot is a subdomain. For example, blog.site.ru is a subdomain of site.ru.

What does a subdomain look like?

It looks like a word before the main address, separated by a dot: shop.site.ru, msk.site.ru or help.site.ru. Technically, www.site.ru is also a subdomain.

Do I have to pay for a subdomain?

You do not need to register or pay for a subdomain separately: the domain owner creates it in DNS settings. You only need to pay for the hosting or service where it is hosted.

Follow the journal

New pieces on websites, SEO and AI come out in the QIO journal. Follow in Google, by RSS or in Telegram to get them first.

Read next

How can we help?
Discuss a project