Remove Addon/Parked Domain Manually on cPanel

Isn't simple as that.
Isn’t simple as that.

Recently I had a problem with a customer trying to remove a addon domain on cPanel. Every time he tries to remove, he got different error messages, like “subdomain ‘shop.example.com’ does not exist for user ‘client’”.

Since cPanel couldn’t do it by itself, I went to the documentation to find where the user configurations are located. According to the documentation, the files are store in /var/cpanel.

Using grep to catch “example.com” related configurations, I found:

/var/cpanel/users/client
/var/cpanel/user.cache/client
/var/cpanel/userdata/client/shop.example.com
/var/cpanel/userdata/client/shop.example.com.cache
/var/cpanel/userdata/client/example.com
/var/cpanel/userdata/client/example.com.cache
/var/cpanel/userdata/client/main
/var/cpanel/userdata/client/main.cache
/var/cpanel/userdata/client/cache
/var/cpanel/userdata/client/cache.json

I edited the files, removing the mentions to “example.com”. After that, I went to the client’s cPanel account and added a test addon domain just to update the cPanel cache. The “example.com” wasn’t there anymore as I expected. So, I removed the test addon domain and went to the Apache configurations.

The cloud server I was has EasyApache 3, so Apache configuration is located at /usr/local/apache/conf/httpd.conf. I again searched for “example.com” and removed the VirtualHost which mentions to “example.com”.

To finish all the process, I just removed the DNS Zone of “example.com”. After 5 minutes of simple search and edit/remove, I had no mentions to “example.com” at all.

If you are in a similar situation, remember to make backup all files you edit/remove.