Converting from cPanel subdomain to WHM account

thoughtcat

Member
Nov 9, 2014
7
0
1
cPanel Access Level
Root Administrator
I recently got a VPS with WHM. My root account is mysite.com. I needed the subdomain hello.mysite.com and didn't really know how to use WHM at the time, so instead of creating a new account in WHM, I did what I was used to doing which was to create hello.mysite.com as a subdomain within my mysite.com cPanel. I installed a Drupal site in the directory public_html/hello. Now however I want to take the site out of the general public_html directory of mysite.com and create its own account in WHM. If I try creating the new subdomain in WHM I get 'The domain “hello.mysite.com” already exists in the Apache configuration.' So I guess I have to remove the existing subdomain from cPanel before I can create the WHM account of the same name. What's the easiest way to convert the original subdomain into a new WHM account without losing the site that is currently living at hello.mysite.com?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
Hello :)

You can delete the subdomain without removing the contents of it's document root. Simply delete the subdomain, create the new account, and then manually copy the data over to it's new location (ensure you update ownership values after copying the data). Also, ensure the hostname of your server does not match the subdomain.

Thank you.
 

thoughtcat

Member
Nov 9, 2014
7
0
1
cPanel Access Level
Root Administrator
Great thanks. I also asked my hosting provider, who recommended creating the new account with a different subdomain name, transferring the files over, then removing the old subdomain and renaming the account to the original name.
 

thoughtcat

Member
Nov 9, 2014
7
0
1
cPanel Access Level
Root Administrator
Hi Michael, quick question, I have removed the subdomain in cPanel and all the site code is still in place as you said. Am I still able to visit the site in the meantime e.g. via an IP address? All my subdomains/sites share an IP address, so I'm not sure if this can be done.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
Hi Michael, quick question, I have removed the subdomain in cPanel and all the site code is still in place as you said. Am I still able to visit the site in the meantime e.g. via an IP address? All my subdomains/sites share an IP address, so I'm not sure if this can be done.
You can manually edit the hosts file on your workstation so that the subdomain loads in the meantime:

hosts (file) - Wikipedia, the free encyclopedia

Just remember to revert the change when it's no longer required.

Thank you.