Prerequisites
- Access to your server's command line interface via SSH or Terminal in cPanel.
- Basic knowledge of command line operations.
- cPanel account with sufficient permissions to add addon domains.
Overview
Adding an addon domain through the command line can be a more efficient method than using the cPanel interface. This guide will walk you through the process using the cpapi2
command.
Steps to Add an Addon Domain
- Log into your server via SSH or open the Terminal in cPanel.
- Use the following
cpapi2
command to add the addon domain:
cpapi2 AddonDomain addondomain dir=%2F$addondir newdomain=$addondomain.tld subdomain=$addondomain.tld
- Replace the following placeholders in the command:
%2F
: Use this in place of any/
in the addon directory path.$addondir
: Specify the path where the domain's content will be stored relative to the account's home directory.$addondomain.tld
: Replace this with the domain name you wish to add.
Important Notes
- Ensure that the directory path for the addon domain is correctly specified to avoid errors.
- Refer to the cPanel API documentation for more information on the
AddonDomain::addaddondomain
function at cPanel API 2 Functions.
Using the command line to add an addon domain can streamline your workflow and provide more control over your server environment. If you encounter any issues or need further assistance, consult the cPanel documentation or contact support.