Move website from sub-domain to primary domain — CyberPanel - WebHosting Control Panel for OpenLiteSpeed
CyberHosting

Move website from sub-domain to primary domain

Hello,

I am trying to figure out how to move my site from a sub-domain to the primary domain of my website created by cyberpanel.

Originally, I created the new website at "dev.example.com" as a staging site to build it while the old website was still functional at "example.com."

Now that the new website is ready to go, I want to switch "dev.example.com" -> "example.com." Searching this forum and the internet, I have been unable to find a solution. Many posts said it is not possible to do within cyberpanel and I saw that it is a tracked feature request.

I tried to utilize the Clone/Staging functionality for wordpress but I kept getting a "Failed to create child-domain for staging environment. [404]."

I also tried to add it as a domain but I kept getting a "Error message: Virtual Host Directory already exists. [404]." I searched my server for the virtual host directory but only the one for "dev.example.com" exists.

Do I need to edit my vHost Conf file? I am at a loss for what to do. Any help would be much appreciated!

Thank you ahead of time.

Comments

  • I take it you created the subdomain with a wordpress installer rather than doing it manually and uploading the files?
  • @ianw5555 I believe that is the case.

    The site is set up on a DigitalOcean Droplet with CyberPanel (https://marketplace.digitalocean.com/apps/cyberpanel).

    Within CyberPanel, I did a one-click install for WordPress (https://docs.litespeedtech.com/cloud/images/cyberpanel/).
  • That is the problem with a one click install. You are stuck with that subdomain. The only solution I can think of is to download a full backup, files and database. Delete the domain, create a new domain and restore the site there.
    You would need to put:
    define('WP_HOME','https://example.com');
    define('WP_SITEURL','https://example.com');
    in your config.php file just under:
    <?php
    define( 'WP_CACHE', true ) ;
    so that wordpress recognises your new url
  • @ianw5555 thank you for the advice! I will try that today and report back.

    Once I backup the whole site, would I just delete it via CyberPanel?
  • Yes but don't forget to download the backup to your PC first and only do so if you are confident you know how to restore a wordpress site from a backup, i don't wish to be responsible for the loss of your site.
  • @ianw5555 Thank you so much for your help! Your advice worked perfectly and the new site is up and running on the new domain!
Sign In or Register to comment.
CyberPanel Discord

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!