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:
staging.yourdomain.com— a testing environment before deploying to productionblog.yourdomain.com— a separate blog sectionshop.yourdomain.com— an e-commerce storeapi.yourdomain.com— a REST API for mobile appsmail.yourdomain.com— mail server (usually created automatically by DirectAdmin)admin.yourdomain.com— a private admin panel
Step-by-Step: Create a Subdomain in DirectAdmin
- Log in to DirectAdmin → click Subdomain Management (under the Domain section)
- Enter the subdomain name in the Subdomain field (e.g.,
blogorstaging) - Select the main domain you want the subdomain under
- Click Create
- 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:
| Name | Type | Value | TTL |
|---|---|---|---|
| blog | A | Server IP Address | 14400 |
| staging | A | Server IP Address | 14400 |
| api | A | API Server IP Address | 14400 |
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:
| Name | Type | Value | TTL |
|---|---|---|---|
| cdn | CNAME | abc123.cloudfront.net | 14400 |
| shop | CNAME | stores.shopify.com | 14400 |
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:
- Go to Subdomain Management → click the subdomain name
- Update the Document Root to your desired path, e.g.,
public_html/wp-staging - 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:
- Free Let's Encrypt — DirectAdmin → SSL Certificates → Let's Encrypt → select your subdomain → Issue
- Wildcard SSL (*.yourdomain.com) — covers all subdomains with a single certificate (purchased separately)
Install WordPress on a Subdomain
Two methods for setting up WordPress on a subdomain:
Method 1: Via Softaculous (Recommended)
- DirectAdmin → Softaculous → WordPress
- Select the subdomain as the installation domain
- Configure as normal and click Install
Method 2: Manual Installation
- Upload WordPress files to the folder your subdomain points to
- Create a new database in phpMyAdmin
- Configure
wp-config.phpwith the new database credentials - Visit
https://staging.yourdomain.comto complete the WordPress setup
Verify Your Subdomain is Working
- Use DNS Lookup: run
dig staging.yourdomain.com Aor use the online tool at asiagb.com/dns-lookup.html - Open
https://staging.yourdomain.comin your browser and verify it loads correctly - If DNS has not propagated yet, wait 5–30 minutes and try again
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
- Create the
staging.yourdomain.comsubdomain in DirectAdmin as described above - Export the production database and import it into a new staging database
- Copy WordPress files from
public_html/topublic_html/staging/ - Update
wp-config.phpin the staging folder to connect to the new staging database - In the WordPress Dashboard → Settings → General, change the site URL to
https://staging.yourdomain.com - Issue a free Let's Encrypt certificate for
staging.yourdomain.comvia 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:
- Subdomains have separate authority — In principle, backlinks to
blog.yourdomain.comdo not directly benefityourdomain.com's authority. Google acknowledges it "often" combines them, but this is not guaranteed. - Subfolders may be better for SEO content — If organic ranking is the primary goal,
yourdomain.com/blog/consolidates all link equity under a single domain more reliably thanblog.yourdomain.com. - Staging must be noindexed — Any staging subdomain must use a
noindexmeta tag or a robots.txt disallow directive. Without this, Google may index duplicate content from staging, hurting your main site's rankings. - SSL is required on every subdomain — A subdomain without SSL displays a "Not Secure" warning, which negatively affects both user trust and SEO signals.
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