I have several cPanel accounts on my server (running Cloudlinux 5). I managed them using WHM.

My current situation (replacing the real domain with example.com):

Account A has an addon domain example.com.

Account B's primary domain is sub.example.com.

I want to add another sub domain sub2.example.com to Account B, so that it points to Account B's document root.

Now cPanel doesn't allow me to do so. It says example.com is owned by another user, which should be Account A, I guess.

Is there any way to point sub2.example.com to Account B's document root? I'm not asking for redirection from sub2.example.com to sub.example.com. The url sub2.example.com should not change.

What I have tried:

  1. Add DNS record: sub2 IN CNAME sub.example.com.

  2. Add sub2.example.com file to /var/cpanel/userdata/AccountB.

sub2.example.com just loads the server IP's default document root.

Any help is appreciated.

1 Answer 1


When cPanel adds a subdomain, it's a subdomain of the domain listed on the account. So, if account B has a primary domain of sub1.example.com, then it could only add domains like sub2.sub1.example.com. Somehow, you would want to be either making it into its own cPanel account, or adding it to the account with the primary domain example.com.

If you tried adding it to the userdata file, did you also /scripts/rebuildhttpdconf and restart Apache? If you're showing the default IP, then Apache doesn't have a VirtualHost entry for that hostname and IP. You could probably hack it like that, though it isn't ideal.

If you must have the subdomains on account B, and the main site on account A, I would recommend changing the A to some other subdomain. I don't think that it could be www.example.com, thought that would be ideal. Maybe www1.example.com. Then, change B to example.com, with all the subdomains added there, and make example.com redirect to the subdomain which you are using for A.

  • Thanks. I found the solution. Besides adding the userdata file, I also have to modify the main file and include sub2.example.com as one of the subdomains. Rebuild and restart Apache. It works!
    – Shawn
    Jul 7, 2016 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.