Introduction
You can use the WHMAPI1 API call create_parked_domain_for_user
for this purpose. This API call works from the command line as well. You can refer to the following links for more information on this particular API call and how to use API calls from the command line in general:
create_parked_domain_for_user
Using cPanel's APIs From The Command-Line
Procedure
Let's assume you want to add any number of parked domains to the already existing virtual host domain.tld
for the user cpuser
.
You need to first create a file (use nano or vi/vim for this purpose), let's call it YOUR_FILE
and add all the domains to the file, each on a separate line. The content of the file should be similar to this:
cat YOUR_FILE
test1.domain.tld
test2.domain.tld
test3.domani.tld
test4.domain.tld
test5.domain.tld
test6.domain.tld
.......
Then use this simple command to loop over the domains in the file adding them one by one as aliases (AKA parked domain) to the domain.tld
virtual host, using the aforementioned API call. Of course here you need to replace the YOUR_FILE
in this command with the absolute path of the file that you've created and also domain.tld
and cpuser
need to be replaced with the appropriate values for your case:
for domain in `cat YOUR_FILE`;do whmapi1 create_parked_domain_for_user domain=$domain username=cpuser web_vhost_domain=domain.tld;done
However, please bear in mind that this is only for demonstration purposes and it's always recommended that you refer to the links provided above and create your own command to completely tailor the command to your specific needs.
Comments
0 comments
Article is closed for comments.