Question
How do you create an addon domain via cpapi2?
Answer
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.
Warning: We strongly recommend that you use UAPI instead of cPanel API 2. However, no equivalent UAPI function exists.
Note: 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:# cpapi2 AddonDomain addaddondomain dir=%2F$addondir newdomain=$addondomain.tld subdomain=$addondomain.tld
---
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
Note: "%2F" must be used in place of any "/" in the addon directory path.
"$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.