How to Change the Primary Domain for a cPanel/WHM Account
If you use multiple aliases or parked domains in a cPanel account, you may want to change the primary domain used for the cPanel account containing them. Wanting to change the primary domain in cPanel is desirable for multiple reasons, such as:
- The site in use switches from one top-level domain (TLD) to another (i.e., .net to .com).
- Your company's name or site changes.
- You no longer use a domain.
- You removed the domain from an account.
- The wrong site name was set as the primary domain.
Whatever the reason for changing the primary domain, the change is relatively simple in your cPanel server’s root login, Web Host Manager (WHM). However, it does make some potentially significant changes to the account that could create the need for additional changes for site functionality. Therefore, it is best to understand these changes before changing the main domain in cPanel/WHM.
Before Changing Your Main Domain in cPanel/WHM
While most changes are made within the cPanel account for the user, this change is not. Changing the primary domain is done via WHM, which requires root-level access. Here are a few considerations before you change your primary domain in cPanel/WHM.
Backups
Before making significant changes to your server, the best practice is to have the ability to revert changes in case of mistakes. Creating a full website backup via cPanel for the account you want to modify ensures you have available backups for restoration in the event of errors. If you use alternate means to back up your accounts, ensure you have available backups before making this change.
DNS
Making the change will modify multiple domain factors, including (if you so choose) the cPanel username (which is usually not advised), the FTP username, and MySQL us. In addition, making this change will delete any custom DNS records if you are using a custom nameserver setup within WHM and hosting your DNS. If you are, go into the DNS editor and take a screenshot of your DNS for the domain or copy the records to a text document before making this change.
An additional effect is that all email accounts change to reflect the new domain. For example, changing the primary domain from yourdomain.com to newdomain.com will change the email account from admin@yourdomain.com to admin@newdomain.com. You may need to update the e-mail address and username (for both incoming and outgoing servers within your e-mail client) on any devices on which the email account is set up.
Aliases
If you already added an alias or addon domain, you need to remove it first. You can save the addon site’s content and site data elsewhere on the server until after this change. You will also want to remove any subdomains.
SSL Certificates
If you have an SSL certificate applied to the account, you will revoke it with this change, and a new SSL is necessary. AutoSSL users can re-run it to ensure all sites have an SSL installed. If you purchased an SSL, you would need to order a new one for the replacement domain name. WordPress users will also need to change the site URL.
Hostname
Often changing the primary domain is confused with the server's hostname, but these are separate changes. However, this does not change the hostname and does not change the server's name within your Liquid Web account. Changing the primary domain will only change data related to the cPanel account and its associated user.
How to Change the Primary Domain in cPanel/WHM
To change the primary domain, you will need to do this within WHM.
- You can access WHM by using the servers IP followed by the port 2087, or if DNS is set up for the hostname, you can access WHM by using the hostname/whm. Another method is to use a domain name on the server followed by /whm:Examples:
- 192.168.1.1:2087 (replace the IP with your servers IP)
- https://hostname.com/whm
- https://domainname.com/whm
- To change the primary domain login to WHM using the root user and root password:
- After logging the top right of your window is a search bar (you may need to expand this menu). Access List Accounts via the search bar and click on the link it displays.
- Find the user you want to modify by typing in the name of the account in the new search bar that opens. Then click the + symbol next to the user:
- Finally, click the Modify Account button:
- Change the Primary Domain to the domain you want in its place:
- Decide if you're going to adjust options. You could decide to modify the databases associated with the domain to include new prefixes, for example, changing the Username.
You have successfully changed the primary domain for this account.
Wrapping Up
After making this change, you may want to keep the old email addresses used by the old primary domain. If this is the case, the fix is simple. Park the old domain on the new one via an alias and create new email accounts under the old domain name within cPanel’s email accounts section. This way, you can still use your existing email accounts and change the primary domain.
For Liquid Web customers hosting with cPanel, our Linux Support team is available to assist with changing your primary domain in cPanel/WHM. Our managed hosting and dedicated server options provide the environment you need for your websites and applications. Contact our sales team for more information.
Related Articles:
About the Author: Ronald Caldwell
Ron is a Technical Writer at Liquid Web working with the Marketing team. He has 9+ years of experience in Technology. He obtained an Associate of Science in Computer Science from Prairie State College in 2015. He is happily married to his high school sweetheart and lives in Michigan with her and their children.
Our Sales and Support teams are available 24 hours by phone or e-mail to assist.
Latest Articles
How to Edit the PHP Memory for Your WordPress Site via WP Toolkit
Read ArticleWhat is CGI-Bin and What Does it Do?
Read ArticleTop 10 Password Security Standards
Read ArticleTop 10 Password Security Standards
Read ArticleHow to Use the WP Toolkit to Secure and Update WordPress
Read Article