Migrate Site from Separate cPanel Subdomain Account to Subdirectory of Existing Account

jethrodesign

Well-Known Member
Feb 17, 2012
67
2
58
cPanel Access Level
Root Administrator
Hi, not sure how best to categorize this question even.

Here's what we need to accomplish, and just want to know the best and/or simplest method of doing so.

A) We have a site in development in it's own cPanel account using a subdomain of a different account we also host (sub.parentdomain.com).

B) The client wants the final launched site to exist as a subdirectory of the parent directory instead of a subdomain as it currently is (parentdomain.com/sub/)

- With these being currently in 2 separate cPanel accounts (we have a dedicated server we manage using WHM), is there a way to have it APPEAR to be in a subdirectory via an Alias or something? We would love for these to remain in separate cPanel accounts for the sake of backups, management, etc.

- If this is not possible, what is the best way to migrate the existing dev site over to the subdirectory of the parent site?

We've always used cPanel Backup/Restore to do any migrations, doing separate Home directory & Database backups/restores. But I'm assuming restoring the Dev site backup onto the parent site would OVERWRITE everything currently there, correct? That would not be good...

Both of the sites are WordPress sites, and need to retain separate databases. I know we'll have to do some database management to update any links on the dev site to match the new subdirectory structure.

Thanks for any tips here!
 

cPanelAnthony

Administrator
Staff member
Oct 18, 2021
1,041
112
118
Houston, TX
cPanel Access Level
Root Administrator
Hello! There would be no way that I'm aware of to alias in the way you mentioned. I would suggest the following as performed by a qualified systems administrator.

  • Use rsync to copy the files and directories of the subdomain in question to the necessary subdirectory
  • Use chown to update the ownerships for all the files and directories as needed at the new location if under a new cPanel account
  • Create new databases for the domain on the subdirectory
  • Dump the current databases to SQL files
  • Import the database data from the SQL files into the new databases
  • Set up any configuration files to reference these new databases

The process in the following article should help.

How to Manually Transfer an Account with Rsync

And then his one for ownership changes.

How to change the ownership of a file or directory