[TUTORIAL] How to change website domain or subdomain

This tutorial is for host admins who want to change subdomain or domain of website without actually recreating a website on CyberPanel or change subdomain or domain of an existing website. Why?

Because this cannot be done automatically on CyberPanel but there is a longer process that if not done correctly can mess up your virtual host configuration.

Before you start remove SSL certificate for subdomain.maindomain.com and remove any mailboxes for that subdomain.

  1. Create the path /home/subdomain1.maindomain.com/public_html

  1. Go to https://SERVER_URL:7080/index.php#view/confMgr.php?m=vh
    and choose the virtual host to change domain. As seen in the image above the url visited is https://SERVER_URL:7080/index.php#view/confMgr.php?m=vh_add-your-domain-here ~ replace add-your-domain-here with your actual domain from the list or existing domain on your cyberpanel server.

  1. Under General tab click edit

  • Document root will not be created by the server automatically if it does not already exist. Please ensure that both the directory exists i.e. /home/add-domain-here and it is owned by the correct user as seen above.

  1. On Basic tab change the Virtual Host Name with subdomain1.maindomain.com from Step 1 as seen in the image above.
  • This will change the virtual host file.

  1. Confirm there is NO paired SSL private key and SSL certificate for SSL listener as seen in the image above,

OR you can visit https://SERVER_URL:7080/index.php#view/confMgr.php?m=sl_SSL to delete relationship between the SSL listener and your virtual host as seen below.

  • By now you see “Configuration has been modified. To apply changes, please perform a graceful restart.” message. Perform a graceful restart as seen below.

6.Reboot the server

  1. Go to https://SERVER_URL:8090/phpmyadmin/index.php?route=/sql&db=cyberpanel&table=websiteFunctions_websites&pos=0 this opens a table in PhpMyAdmin as seen in image above.

On that table websiteFunctions_websites look for the line subdomain.maindomain.com (your domain) and change to subdomain1.maindomain.com (the new domain you want to change to)

  1. Go back to list of websites - viola! You can see subdomain1.maindomain.com and now you can Issue SSL etc

Hello. Can you tell me how to create such a path?
/home/subdomain1.maindomain.com/public_html

This can only be possible if you create a child domain https://SERVER_URL/websites/CreateNewDomain child domains are owned by a master website

Looks like some are having hard times following your suggestions, so far you’re recommending to do the following:
Assuming I want to change a live website hosted as test.domain.com to test2.domain.com.

  1. Remove SSL issues certificate, I’ve done that by executing the command: rm -rf /etc/letsencrypt/live/test.domain.com
  2. Create the path /home/test2.domain.com/public_html , you mention that this can only be possible if I create a child domain via cp dashboard.
    If I do that, it asks to select the website, I selected my existing test.domain.com but it creates a path of test.domain.com → / test2.domain.com
    and from here things doesnt make sense anymore.
    Is there a more simplified version of changing the domain of test.domain.com into something different without too much hassle? please let us know

This tutorial is not implementable, at least for me.
I have tried from step 1, but whoever try will definitely stopped in step 4. Why? Because we will get notification that subdomain1.maindomain.com has been used by another VHost.
I also have tried another way by deleting subdomain1 from VHost. But in the end still can’t get connected to subdomain1.
I also can not find subdomain1 in websiteFunctions_websites of PHPAdmin. It only list the domain, not subdomain/child domain.

Yes because you already had another vhost with same domain. Create a separate topic for this as it is different from what you are facing

Hi. Thanks for your reply. I already created a topic for this question. Please kindly have a look.