Question
Is it possible to park a domain on another domain other than the primary domain?
Answer
It is possible to park a domain on a subdomain of the primary domain using the API only. Addon domains are essentially parked on a subdomain, so you would need to park the domain on the addon domain's subdomain.
The documentation for the API that you would need to use can be found here:
cPanel API 2 Functions Park::park
Description
This function creates an alias (parks a domain on another domain).
Warning:
We strongly recommend that you use UAPI instead of cPanel API 2.
However, no equivalent UAPI function exists.
Example
Here's a command-line example of how you would park aliasdomain.tld on addondomain.tld via the API on the command-line:
# cpapi2 --user=ct AddonDomain addaddondomain dir=addonfolder newdomain=addondomain.com subdomain=addondomain.com
...
reason: The system successfully parked (aliased) the domain “addondomain.com” on top of the domain “addondomain.com.primary.com”.
...
result: 1
func: addaddondomain
module: AddonDomain
# cpapi2 --user=ct Park park domain=aliasdomain.tld topdomain=addondomain.com
..
reason: The system successfully parked (aliased) the domain “aliasdomain.tld” on top of the domain “addondomain.com.primary.com”.
...
After completing this, both the addon domain and the aliased domain share the same virtualhost:
# grep -A1 "ServerName addondomain.com.primary.com" /etc/apache2/conf/httpd.conf
ServerName addondomain.com.primary.com
ServerAlias addondomain.com aliasdomain.tld mail.addondomain.com mail.aliasdomain.tld www.addondomain.com www.addondomain.com.primary.com www.aliasdomain.tld
--
ServerName addondomain.com.primary.com
ServerAlias addondomain.com aliasdomain.tld mail.addondomain.com mail.aliasdomain.tld www.addondomain.com www.addondomain.com.primary.com www.aliasdomain.tld cpcalendars.aliasdomain.tld cpcalendars.addondomain.com cpcontacts.aliasdomain.tld cpcontacts.addondomain.com webdisk.aliasdomain.tld webdisk.addondomain.com webmail.aliasdomain.tld webmail.addondomain.com cpanel.aliasdomain.tld cpanel.addondomain.com