I have the following setup: two WordPress blogs, one on the main domain, let's call it example
and one on a sub-domain sub.example
. After a few years of running these blogs independently I have to merge the sub-domain into the main domain:
sub.example > example
Each blog's database is over 100MB and the sub-domain uploads
folder is over ~15GB (lots of high-res images). Both blogs have the same authors and only 2 common categories.
What's the best (safest) way of doing the merge to ensure that everything runs properly?
These are the steps I considered:
- Backup each database;
- Optimize each database;
- Backup again;
- Export XML from
sub.example
; - Move the contents of
sub.example/wp-content/uploads/
toexample/wp-content/uploads/
- (and hope there are no files identically named); - Import XML into
example
; - Create
.htaccess
file onsub.example
to 301 redirect all toexample
;
The only step I'm not sure is #5, should I move (merge) the uploads
folders or let the import process handle this as well? I'm thinking that since it's 10 GB worth of images the import process might fail...
If anyone has a better process or if you see a problem with one of the steps from above, let me know, I'll appreciate any help on this matter!
I have the following setup: two WordPress blogs, one on the main domain, let's call it example
and one on a sub-domain sub.example
. After a few years of running these blogs independently I have to merge the sub-domain into the main domain:
sub.example > example
Each blog's database is over 100MB and the sub-domain uploads
folder is over ~15GB (lots of high-res images). Both blogs have the same authors and only 2 common categories.
What's the best (safest) way of doing the merge to ensure that everything runs properly?
These are the steps I considered:
- Backup each database;
- Optimize each database;
- Backup again;
- Export XML from
sub.example
; - Move the contents of
sub.example/wp-content/uploads/
toexample/wp-content/uploads/
- (and hope there are no files identically named); - Import XML into
example
; - Create
.htaccess
file onsub.example
to 301 redirect all toexample
;
The only step I'm not sure is #5, should I move (merge) the uploads
folders or let the import process handle this as well? I'm thinking that since it's 10 GB worth of images the import process might fail...
If anyone has a better process or if you see a problem with one of the steps from above, let me know, I'll appreciate any help on this matter!
Share Improve this question asked Jun 11, 2015 at 21:38 George GrigoritaGeorge Grigorita 6192 gold badges9 silver badges21 bronze badges1 Answer
Reset to default 1Your logic and the steps you plan on following look good to me. This is more or less exactly how I would handle the issue.
However when you import the XML file from sub.example into example, you'll want to check the links to the media files within the newly-imported posts. I believe they are still going to be referencing the sub.example URL. If that's the case, you will need to run a database updating script or command to update all instances of sub.example to example.
I use the Interconnect/IT search and replace script or WP-CLI
So moral of the story - COPY the wp-content/uploads folder over. Don't DELETE the wp-content/uploads folder from sub.example until you can confirm all of your URLs are correct.