Some users may wish to add an addon domain to their account via the command line instead of the cPanel interface. This is accomplished with the
AddonDomain function of the
We strongly recommend that you use UAPI instead of cPanel API 2. However, no equivalent UAPI function exists.
Please note that In cPanel & WHM version 76 and later, when the Web Server role is disabled, the system disables this AddinDomain capi2 function.
- Access the server's command line as the cPanel user via SSH or "Terminal" in cPanel.
- Use the
cpapi2command to add the addon domain.
[cpuser@server ~]cPs# cpapi2 AddonDomain addaddondomain dir=%2F$addondir newdomain=$addondomain.tld subdomain=$addondomain.tldPlease note that "%2F" must be used in place of any "/" in the addon directory path.
reason: The system successfully parked (aliased) the domain “addondomain.tld” on top of the domain “addondomain.tld.domain.tld”.
Please note that "$addondir" and "$addondomain.tld" must be replaced with the path that the domain's content will be stored relative to the account's home directory and the domain to add, respectively.