Introduction
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 cpapi2
command.
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.
Procedure
- Access the server's command line as the cPanel user via SSH or "Terminal" in cPanel.
- Use the
cpapi2
command to add the addon domain.[cpuser@server ~]cPs# cpapi2 AddonDomain addaddondomain dir=%2F$addondir newdomain=$addondomain.tld subdomain=$addondomain.tld
Please note that "%2F" must be used in place of any "/" in the addon directory path.
---
cpanelresult:
apiversion: 2
data:
-
reason: The system successfully parked (aliased) the domain “addondomain.tld” on top of the domain “addondomain.tld.domain.tld”.
result: 1
event:
result: 1
func: addaddondomain
module: AddonDomain
postevent:
result: 1
preevent:
result: 1
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.
Comments
0 comments
Article is closed for comments.