You can point a subdomain such as blog.yourdomain.com or app.yourdomain.com to a completely different server, platform, or IP address by adding a DNS record for it in your domain's DNS zone. You do not need to create the subdomain inside your hosting account at all: the DNS record does all the work of directing visitors to wherever the subdomain is actually hosted.
When to use a DNS-only subdomain instead of a hosting subdomain
These are two different things, and mixing them up is the most common mistake:
- Creating a subdomain in your hosting control panel reserves a folder for it on your own hosting account. Use this when the subdomain's content will live on the same server as your main website.
- Adding a DNS record only (what this article covers) sends the subdomain's traffic somewhere else entirely: another host, a third-party platform, or a separate server with its own IP address. Do not also create a matching subdomain in your control panel, since that would point it back to your own hosting and conflict with the DNS record.
If a subdomain with the same name already exists in your hosting account, remove it first (see your control panel's subdomain management screen) before adding the external DNS record, so the two don't compete.
What you need before you start
- The exact subdomain you want to point (e.g. shop for shop.yourdomain.com).
- Where it's going: either a hostname the destination gives you (e.g. a platform's default domain) or a specific IP address.
- The record type to use: a CNAME record if you were given a hostname, or an A record if you were given an IPv4 address.
Adding the DNS record
In cPanel
- Log in to cPanel and open Zone Editor under the Domains section.
- Find your domain and click Manage.
- Click Add Record and choose CNAME Record or A Record depending on what the destination gave you.
- In the Name field, enter your subdomain (e.g. shop) followed by your domain, such as shop.yourdomain.com.
- In the Record or Address field, enter the destination hostname (for CNAME) or IP address (for A), then click Save Record.
In DirectAdmin
- Log in to DirectAdmin and open DNS Management under the Account Manager or Domain Setup section.
- Select the domain you want to edit.
- Under Add a New Record, choose CNAME or A depending on what the destination gave you.
- Enter your subdomain name in the record field (e.g. shop), and enter the destination hostname (for CNAME) or IP address (for A) in the value field.
- Click Add Record to save it.
A CNAME record's value should point to a hostname, never to another CNAME's target chained through multiple layers, and a subdomain with a CNAME record cannot also have other DNS records (like an MX record) on that same name. If the destination only gave you an IP address, use an A record instead.
Confirming it worked
DNS changes are not instant. Give it up to a few hours to take effect everywhere, though it's often much faster. To check:
- Visit the subdomain directly in your browser once some time has passed.
- Use an online DNS lookup tool and search for your subdomain's CNAME or A record to confirm it shows the value you entered.
If the subdomain still shows your old hosting or a "not found" page after several hours, double-check that no matching subdomain still exists in your hosting control panel, and that you entered the destination value exactly as given.
For a broader look at DNS record types and how they work, see How to Add or Edit a DNS Record (A, CNAME, MX, TXT).