Create Subdomain in DirectAdmin

A subdomain is an extension of your main domain that lets you organize different sections of your website under separate addresses. For example: blog.yourdomain.com, shop.yourdomain.com, or api.yourdomain.com. Each subdomain can point to a separate folder on the same server or even to a completely different server.

What Can You Use Subdomains For?

Subdomains appear before the main domain name and are commonly used for:

Step-by-Step: Create a Subdomain in DirectAdmin

  1. Log in to DirectAdmin → click Subdomain Management (under the Domain section)
  2. Enter the subdomain name in the Subdomain field (e.g., blog or staging)
  3. Select the main domain you want the subdomain under
  4. Click Create
  5. DirectAdmin automatically creates a new folder at public_html/subdomain-name/ as the document root

DNS propagation note: After creating a subdomain, DNS may take 5–30 minutes to propagate on the same nameserver, or up to 24–48 hours if you recently changed nameservers.

Configure DNS Records for Your Subdomain

When DirectAdmin creates a subdomain within the same DNS zone as your main domain, it adds an A record automatically. However, if you need to point a subdomain to a different IP or service, configure DNS manually:

Add an A Record (Point to IP Address)

Go to DirectAdmin → DNS Management → Add a new record:

NameTypeValueTTL
blogAServer IP Address14400
stagingAServer IP Address14400
apiAAPI Server IP Address14400

Add a CNAME Record (Point to Another Domain)

Use CNAME when pointing a subdomain to a third-party service such as a CDN, Shopify store, or external platform:

NameTypeValueTTL
cdnCNAMEabc123.cloudfront.net14400
shopCNAMEstores.shopify.com14400

Never use CNAME on the root domain (@). Doing so will break your MX records and email delivery. Always use A records for the root domain.

Change the Document Root for a Subdomain

By default, DirectAdmin places subdomain files at ~/public_html/subdomain/. You can change this:

  1. Go to Subdomain Management → click the subdomain name
  2. Update the Document Root to your desired path, e.g., public_html/wp-staging
  3. Click Save

Example: If your WordPress staging install is in public_html/staging/ and you want staging.yourdomain.com to point there, set the document root to public_html/staging.

Install SSL on a Subdomain

Each subdomain needs its own SSL certificate — or you can use a Wildcard SSL that covers all subdomains:

Install WordPress on a Subdomain

Two methods for setting up WordPress on a subdomain:

Method 1: Via Softaculous (Recommended)

  1. DirectAdmin → Softaculous → WordPress
  2. Select the subdomain as the installation domain
  3. Configure as normal and click Install

Method 2: Manual Installation

  1. Upload WordPress files to the folder your subdomain points to
  2. Create a new database in phpMyAdmin
  3. Configure wp-config.php with the new database credentials
  4. Visit https://staging.yourdomain.com to complete the WordPress setup

Verify Your Subdomain is Working

Wildcard SSL vs. Per-Subdomain Certificates: Which Should You Choose?

When managing multiple subdomains, choosing the right SSL strategy saves significant time and administrative overhead. The two main options each have different trade-offs:

Criteria Let's Encrypt (Free) Wildcard SSL (*.yourdomain.com)
Coverage One certificate per subdomain All single-level subdomains in one cert
Cost Free From 5,000 THB/year
Validity 90 days (auto-renewal) 1 year
Best for Few subdomains, frequently changing Many subdomains, minimal management

Note: Wildcard SSL covers only single-level subdomains. *.yourdomain.com covers blog.yourdomain.com but not dev.blog.yourdomain.com. For deeper levels you need additional Wildcard certificates or a Multi-SAN certificate.

Setting Up a Professional Staging Environment on a Subdomain

A staging environment is a testing server that mirrors your production site as closely as possible. It lets you safely test plugin updates, theme changes, or core upgrades before pushing them live. Using a subdomain for staging is the most widely adopted best practice in web development.

Steps to Configure WordPress Staging on a Subdomain

  1. Create the staging.yourdomain.com subdomain in DirectAdmin as described above
  2. Export the production database and import it into a new staging database
  3. Copy WordPress files from public_html/ to public_html/staging/
  4. Update wp-config.php in the staging folder to connect to the new staging database
  5. In the WordPress Dashboard → Settings → General, change the site URL to https://staging.yourdomain.com
  6. Issue a free Let's Encrypt certificate for staging.yourdomain.com via DirectAdmin

Security note: Always set your staging site to discourage search engines (WordPress Settings → Reading → Discourage search engines) and consider adding HTTP Basic Authentication via .htaccess to prevent public access to your staging environment.

Subdomains and SEO: What You Need to Know Before Deciding

Before creating a subdomain, it helps to understand how Google treats subdomain content compared to the main domain. While Google generally crawls and indexes subdomains like any other domain, a few SEO considerations are important:

Rule of thumb: Use a subdomain when you need to separate an application or environment that is fundamentally different from your main website — such as a staging server, REST API, or completely separate application. Use a subfolder when you want to publish blog content or articles that should share SEO authority with your main domain.

Unlimited Subdomains on All Hosting Plans

AsiaGB Hosting supports unlimited subdomains with DirectAdmin and free Let's Encrypt SSL — starting at 500 THB/year with 99% Uptime SLA.

View Hosting Plans