Question
Is it possible to park a domain on a domain other than the primary domain of a cPanel?
Answer
The cPanel interface for an account will allow you to create a parked domain (also known as a domain alias) only for the primary domain on the account. It is possible to create a domain alias using the whmapi on an existing addon domain with the API command documented here:
Addon domains may be able to refer to the same document root and pull up similar contents, but they do not share a virtual host in the way that an aliased domain will. The following process can be used to create an aliased domain on an addon domain:
- Access the server through SSH as the "root" user, or a reseller that owns the account you wish to add the alias to.
- Run the following whmapi command, where $user is the cPanel user that owns the domain, $targetdomain is the existing domain on which you want to park, and $aliasdomain is the domain you wish to park onto the target domain:
whmapi1 --output=jsonpretty create_parked_domain_for_user domain='$aliasdomain' username='$user' web_vhost_domain='$targetdomain'
- You should receive a report of successful output:
{
"metadata" : {
"command" : "create_parked_domain_for_user",
"reason" : "OK",
"result" : 1,
"version" : 1
}
}