Below, you'll find the steps needed in order to convert an accounts primary domain to an addon domain.
If you would like to update your current primary domain to an addon domain that is configured to your cPanel, you should only need to remove the addon domain, and then update the primary domain you have set. You can remove the addon domain name, and then use "WHM >> Modify an Account" to convert the primary domain name to the addon domain name. You can do the following:
- Back up the account in question before making any changes.
- In the account's cPanel, remove the addon domain. This will not remove the subdirectory that contains the addon domain's site content.
- In the WebHost Manager, use Main >> Account Functions >> Modify an Account to change the domain name associated with the account in question.
- Move your site content from the addon domain's subdirectory to the public_html directory.
- Recreate any e-mail addresses and FTP users that belong to the domain that was the addon domain.
It is strongly recommended that you create a backup prior to completing this task. You can do this from the shell as root with the following command:
# /scripts/pkgacct cpanelaccount
If you would like to you use our API, you can do so by following: https://documentation.cpanel.net/display/DD/WHM+API+1+Functions+-+modifyacct
The WHM API 1 function referenced will allow you to rename the primary domain name associated with an account. It's not possible to rename an addon domain name. You'd have to add a new addon domain name and configure it with the same document root, and then remove the old one.