Domain already exists error while adding a subdomain or addon domain in cPanel

Domain already exists error while adding a subdomain or addon domain in cPanel

In this blog we are going to see a  very common error when adding an addon or parked domain via cpanel. This error we see is usually very generic and doesn’t provide any information such as “cannot create domain”. This is usually due to the domain name existing anywhere in the cPanel configuration and checking these locations should help you find the domain which is causing the issue.

Reason 1: There is an existing zone file on the server.

1) You can use the following command to check whether zone exists or not,

# dig @server_ip domain.com

If there is a zone file exists, this will show the A record of the domain.com.

2) If there is a zone file that exists, log into the server that the zone file is pointing to and make sure the domain doesn’t exist:

# /scripts/whoowns domain.com

If it does, you would need to remove this prior to adding their new addon domain. If it does not, continue on

3) Remove the zone file from the server by running the following command:

# /scripts/killdns domain.com

This will remove the DNS zone and will help you add the addon or parked domain again.

You can also remove the DNS in WHM using “Delete a DNS Zone” option.

Reason 2: There are old traces of the domain on the server

1) Log into the server where the customer is seeing problems adding the domain and confirm that the domain does not exist on the server.

# /scripts/whoowns domain.com

2) Check Cpanel files for traces of the problem domain name

# grep domain.com /var/cpanel/users/*
# grep -R domain.com /var/cpanel/userdata/*

3) Edit any files that are found and remove the traces of the domain name the customer is trying to add. You also may need to remove the entire file for the domain in the /var/cpanel/userdata/USERNAME/ directory.

4) Rebuild the user domains database

# /scripts/updateuserdomains

5) Rebuild the Apache configuration and make sure apache is running with all traces of the bad domain removed.

# /scripts/rebuildhttpdconf 
# service httpd restart

This should have all traces that were left behind from when this domain name was removed in the past and then will no longer cause a conflict when the customer tries to add the domain again.

Think, this post help you in resolving. Please share your comments to improve.

For securing your cPanel server, please click here

You may also like...

Leave a Reply

Your email address will not be published.