It's common to build a new site under a subdomain first, something like test.yourbusiness.com, before you're ready to launch it on its own domain name. Once you register that real domain, you don't need to rebuild the site from scratch. You add the new domain as an addon domain pointing at the same files the subdomain already uses, then retire the subdomain. This article walks through both control panels.
Before You Start
- Make sure the new domain is registered and you can update its nameservers or DNS records (if it's registered with ZIPROF, this is straightforward from your client area).
- Note the exact folder your subdomain's files live in, usually something like public_html/test. You'll point the new domain at this same folder.
- Take a quick backup of the site's files and database before making changes.
Don't delete the subdomain or its files yet. You'll keep them in place until the new domain is working, then remove the subdomain afterward.
Step 1: Point the New Domain's Nameservers to Your Hosting Account
If the new domain isn't already using your hosting account's nameservers, update this first at your domain registrar. Nameserver and DNS changes can take a few hours to take effect, so it's worth doing this step before you touch the control panel.
Step 2: Add the Domain as an Addon Domain Pointing to the Same Folder
In cPanel
- Log in to cPanel and open Domains.
- Click Create A New Domain.
- Enter the new domain name.
- Untick Share document root if it's ticked, then manually set the document root to the existing subdomain folder, for example public_html/test.
- Click Submit.
In DirectAdmin
- Log in to DirectAdmin and open Domain Setup.
- Click Add Another Domain.
- Enter the new domain name.
- Instead of letting DirectAdmin create a new folder, set the domain's document root to the existing subdomain folder path.
- Click Create.
At this point, both the old subdomain and the new domain point to the same files, so your site is reachable at either address.
Step 3: Test, Then Retire the Subdomain
Before you tell customers about the new domain, open it directly in a browser to confirm the site loads correctly. If it's a WordPress site, log in to Settings > General and update the WordPress Address (URL) and Site Address (URL) fields to the new domain, since WordPress stores its own URL and won't switch automatically.
Once everything checks out on the new domain, remove the subdomain so you're not running the same content under two addresses:
In cPanel
- Go to Domains, find the subdomain in the list, and click Remove next to it.
In DirectAdmin
- Go to Domain Setup, select the subdomain, and click Delete.
Removing the subdomain entry only removes the subdomain address. It does not delete the files, since the new domain is still using the same folder.
A Few Things to Check Afterward
- If the site uses HTTPS, you'll need a fresh SSL certificate covering the new domain name, since the subdomain's certificate won't cover it.
- Update any hardcoded links, contact forms, or payment callback URLs that referenced the old subdomain.
- If you'll eventually stop using the subdomain name entirely, consider a redirect from it to the new domain for a transition period so old links and bookmarks still work.
If you'd rather preview the new domain working before any DNS changes go live, see How to Preview Your Website Before Pointing Your Domain's DNS.