Link to home
Start Free TrialLog in
Avatar of A A

asked on

Merging old data from old wordpress website (some webpages) to new wordpress migrated from old wordpress without losing new data in new wordpress and select specific data from old wordpress

we have hosted WordPress site called WordPress 1 on EC1 instance that have lamp on same server then we extracted all WordPress 1 and we make new instance that have lamp and WordPress migrated to new server EC2  and we keep adding data to new WordPress called WordPress 2 that include old data of WordPress 1 and additional changes after while we found that we need some webpages that we missed from old WordPress so how can we merge 2 WordPress or identify webpages data from old WordPress without overwriting WordPress 2 known that they share most of same data from before but WordPress 1 have missing data that is not reflected to WordPress 2 and WordPress 2 is current server that have changes since migrated WordPress 1 so we need build on wordpress 2 by selecting webpages (data)from wordpress so how can we identify location of those  old webpages(WordPress1) and extract it in new wordpress 2  and pointing it to the right direction without repeating common data again..
Avatar of David Favor
David Favor
Flag of United States of America image

What you're describing is complex.

Here's how I've done this in the past.

Shell into your machine/container/VM, using ssh.

If you don't have ssh access, you'll have to somehow go through all these steps using a backup, restored onto a staging server.

Bottom line, nearly impossible to do this... with any confidence... without doing the following steps on the command line.

You'll be writing a script to do this using to do all the heavy lifting.

1) Write a script that downloads all pages + posts into a directory.

2) You'll run this on EC1, then copy over all the files into an EC1 directory, likely under your EC2 DocumentRoot directory.

3) Now you'll run the same script on EC2.

4) At this point you have the EC1 + EC2 directories parallel to each other, containing all page-$id + post-$id content off both sites.

5) Now run this command... adding any other diff options you require...

diff --brief --recursive --ignore-case --ignore-all-space --ignore-blank-lines EC1 EC2

Open in new window

6) From the diff output you'll determine what you have to fix.

What you do to fix this varies.

For a handful of posts, you'll just clone the changes over to EC2.

For 1000s of posts (last time I had to do this), you'll write some sort of custom code to merge changes.

7) Keep changes in EC2-new or some other directory, so you never pollute original files.

Once you're finished doing all the merge work, then you'll run a script to look at the page/post + $id, then upload/overwrite the EC2 content.
Having gone through this... laborious process... for several projects now...

Likely good to completely decommission EC1, after you dump all the pages + posts.

This might be a simple as blocking logins, except for you, so no site changes occur, till you can completely destroy EC1.

Also on EC1, you can use this decommissioning trick.

Install the plugin (only truly working redirect plugin I've ever found in the repository) on EC1.

Then do a 302 (not a 301, because any typo on a 301 or requirement to use EC1 ever again will fail completely with 301s, for all returning visitors).

So do a 302, per page from EC1 -> EC2.

So each time you patch one of the files in the EC2-new directory + upload it to EC2, then do a 302 from the EC1 page/post slug (URL) to EC2.

Then once you've uploaded the EC2-new content into EC2, destroy the related EC1 + EC2 + EC2-new files.

This will help you keep track of where you are in this process... especially if you have 1,000s or 10,000s of files to merge.
Avatar of A A


Thank David
how can I map specific webpages from word press website and import them only in new wordpress website 
Avatar of David Favor
David Favor
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial