Homeglossary

Subdomain

A subdomain is a DNS-based hostname that adds a label before a parent domain, such as app.example.com or docs.example.com. It can direct visitors and software requests to a separate application, server, or service while remaining under the same registered domain. Subdomains are commonly used to separate technical functions, environments, or audiences without buying another domain.

Deploy distinct app experiences with Emergent.

What is a subdomain?

A subdomain is a DNS-based hostname placed before a parent domain, such as app.example.com or docs.example.com. It sends browser and software requests to a specific application, server, or service under the same registered domain. In app.example.com, “app” is the subdomain, “example” is the registered domain, and “.com” is the top-level domain. A subdomain is a hostname, not a folder such as example.com/app, and does not automatically mean a separate website.

How a subdomain works in DNS

DNS translates a hostname into a destination. A subdomain needs a DNS record and a destination configured to serve that hostname.

  1. A user or application requests a hostname such as api.example.com.
  2. DNS finds an A or AAAA record for an IP address, or follows a CNAME record to another hostname.
  3. The request reaches a web server, hosting platform, load balancer, or edge network.
  4. The service routes the hostname to the correct application or deployment.
  5. An HTTPS certificate must cover the hostname for a trusted secure connection.

Subdomain vs. subdirectory

Both organize web content, but create different technical boundaries.

AreaSubdomainSubdirectory
Exampleapp.example.comexample.com/app
RoutingSeparate DNS and hostname routingUsually one host and application route
Cookies and CORSCan require explicit cross-origin planningUsually shares one origin
Best fitIndependent apps, APIs, or environmentsClosely related site sections
Search visibilityNeeds deliberate linking and measurementOften simpler to manage as one site structure

Common software uses for subdomains

Subdomains clarify a service’s role and allow independent routing.

  • app.example.com for a signed-in web application.
  • api.example.com for an application programming interface.
  • docs.example.com or status.example.com for documentation and service status.
  • staging.example.com and preview.example.com for pre-release testing.
  • tenant.example.com for customer-specific application instances.
  • eu.example.com for regional routing or localized experiences.

Benefits of using subdomains

A subdomain can reduce coupling between services without another registered domain.

  • Independent deployments and infrastructure for each hostname.
  • Clearer ownership for teams maintaining different services.
  • Safer testing when staging traffic is isolated from production.
  • Flexible routing to a CDN, API gateway, or different hosting provider.

Practical limits and security considerations

A subdomain is an organizational and routing tool, not a security boundary by itself.

  • DNS changes can take time to propagate, so plan ownership and rollback procedures.
  • Certificates must include each hostname, or use a correctly managed wildcard certificate.
  • Host-only cookies stay on one hostname, while cookies set for.example.com may be sent to multiple subdomains.
  • Different subdomains are different web origins, so CORS, redirects, and authentication need explicit configuration.
  • Protect staging and preview hosts from indexing, public access, and production credentials.
  • Use consistent names for production, testing, and service endpoints.

Using subdomains when deploying with Emergent

When deploying a full-stack product built with an AI web app builder, plan a production hostname such as app.example.com and separate URLs for staging or previews. Emergent helps teams build and ship applications, while a clear hostname plan keeps deployment destinations understandable. Explore related web terms in the Emergent glossary. Deploy distinct app experiences with Emergent.

Start Building
on Emergent today
Start Building