HomeHome : Help Center : Question

How do I remove a subdomain that does not show up in cPanel?

Answer: Creating and deleting subdomains within cPanel is usually a pretty easy task. Just log into cPanel and open the "Subdomains" panel within the Domains section. To create a subdomain, simply type the name of the subdomain and click "Create." To remove a subdomain, just click "Remove" next to the sudbdomain you want to delete.

However, if a subdomain has not been deleted properly, you may not be able to create a subdomain with the same name. Instead, when you click "Create," you may be presented with the following error message:

Error from domain wrapper: Domain already exists, it was not added.

If the subdomain exists, but does not show up in the subdomain list, how do you delete it? This is the dilemma I was faced with after restoring a user account using the WHM/cPanel Backup feature. Since I didn't select the "Restore Sub-domain Entries" box when I performed the restore, the subdomain was not recreated. However, since the subdomain information was still lingering on the server, cPanel thought the subdomain still existed.

I tried to remedy the problem by deleting the subdomain folder inside the public_html directory and all files that included the name of the subdomain. However, cPanel still produced the same error. Then I noticed the missing subdomain still showed up when I selected "List Subdomains" in WHM. Therefore, it appeared the subdomain information was most likely being stored outside the user's directory. This led me to check the Apache configuration file "httpd.conf," which is located in the following directory:


I downloaded a copy of the httpd.conf file and opened it in a text editor. I noticed the old subdomain was still listed as a virtual host near the end of the document. So I deleted the entire subdomain entry between the <VirtualHost> and </VirtualHost> tags (18 lines total) and saved the file. Then I uploaded it back to the server, overwriting the old file. When I chose the "List Subdomains" option in WHM, the old subdomain was no longer listed. Better yet, when I attempted to recreate the subdomain in cPanel, it created the subdomain without any problems.

This subdomain issue appears to be a small bug in cPanel and probably affects a very limited number of users. However, if you have been wondering why you can't recreate a subdomain that has already been deleted, hopefully you will find this information helpful.

Published: November 9, 2008 — by Per Christensson

Answer from the PC Help Center