Switch subdomain content to primary domain and vice-versa

Operating System & Version
linux
cPanel & WHM Version
112.0 (build 5)

aneeb

Registered
Aug 3, 2023
1
0
1
Portugal
cPanel Access Level
Website Owner
Good morning!

I created a wordpress website in a subdomain, inside the main domain (which has the old website). Now, with the new website completely finished, I wanted to switch the new website content to my main domain (and the old website content to a subdmain). I also wanted the new website to keep the url of the old website, which I think depends on the domains. Can someone pleasewalk me through the steps on how I should procede to migrate the contents between the main domain and subdomain, as well as the modifications needed in the database?

Thank you!
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
16,517
2,607
363
cPanel Access Level
Root Administrator
Hey there! The short answer is "no" - there's a ton of manual work involved and we don't offer that level of support through Forums or through a ticket as it's not related to any cPanel tools.

The longer answer - could you use WordPress Toolkit to clone your site and get things working that way? WP Toolkit
 

retechpro

Well-Known Member
Dec 23, 2022
141
16
18
Pakistan
cPanel Access Level
Root Administrator
Good morning!

I created a wordpress website in a subdomain, inside the main domain (which has the old website). Now, with the new website completely finished, I wanted to switch the new website content to my main domain (and the old website content to a subdmain). I also wanted the new website to keep the url of the old website, which I think depends on the domains. Can someone pleasewalk me through the steps on how I should procede to migrate the contents between the main domain and subdomain, as well as the modifications needed in the database?

Thank you!
First took the whole cpanel backup before doing anything,
Then
Took a subdomain backup in zip file.
Took a main domain backup in zip file.

Move the subdomain zip file in main domain and extract here.
Move the main domain zip file in subdomain and extract here.

We have moved the subdomain data into main domain and main domain data into subdomain.

Now go to main domain database, check the database name in wp-config file . Then go to wp-options table and change the url.
Https://maindomain.com to https://maindomain.com/subdomain


Same as for subdomain
Change the url from https://maindomaim.com/subdomain to https://maindomain.com

Now we have moved the both sites and change the url.

Note : Before doing anything. Took a backup first.