Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Migrating a WordPress website

I have four websites on a host server that has become compromised and I would like to move them to a new host. However, they are all WordPress sites and there is no way to move them. I have tried 5 different plug-ins and spent the past 3 days working on this. Can anyone help with this, or does anybody have experience moving WordPress sites?

2 Answers

James Barnett
James Barnett
39,199 Points

My advice, if the server is compromised then your sites are compromised. Restore from a known good backup.

Of course if that's too much work or you neglected to make regular backups you can always pretend that you don't care that your site is secure and migrate them anyway.

Well, my sites were not compromised, so that isn't a problem. The main problem is that the host server's email servers are messed up and I can't send email to any of my government clients, which is about 90% of my clients. That is the problem. The solution, then, was to move all of my accounts from my reseller account with the original host to a better host. I have moved an associate of mine to the new host and he has no problem sending emails to them now. I just have a few sites that I want to move, but they are the remaining wordpress sites and wordpress does not like to migrate. Short of starting over from scratch, does anybody know how to move a wordpress site?

James Barnett
James Barnett
39,199 Points

That's not compromised sounds like they are on a real-time spam blacklist.

Well, I know about a month back they were hacked and were down for nearly two days, it was then that the problems began. So, i considered it compromised. But, if it is a real time spam blacklist, so be it. The problem still stands. I need to migrate the wordpress sites from the host to a new host. Any help would be much appreciated.

James Barnett
James Barnett
39,199 Points

If a server was hacked then the only way to be sure that your wordpress database doesn't have malicious data is to restore from backup before the hack.

I believe there is a fundamental breakdown in communication here. I have excellent back-ups of all the websites in question, they are perfect and intact and show no signs of malicious content. I have attempted to upload these sites to the new host with no success. It is apparent that wordpress does not like to migrate. I am trying to determine whether this is a fault of mine, or a fault of wordpress. If it is a fault of mine, I have no problem rebuilding the sites from scratch, it will take me a Sunday afternoon, but it is manageable and something I am trying to avoid. What I would like to know is: Does anybody know of a way to migrate a wordpress site, without having to rebuild it from scratch, from one host provider to another host provider? All attempts that I have made have failed.

Have you tried the duplicator plug in?

James Barnett
James Barnett
39,199 Points

If you have backups of both the content (code) and database then you have everything you thing to migrate to a new server. If you've already have a hosting account setup at a different company.

The directions in this thread should help you, it's critical that you skip the first step and use a backup from a month ago before the server was compromised.

Thank you, James. I will give Zac Gordon's instructions a try.

Still not working. Have tried 5 more times. Went to WordPress site and used their instructions which are the same as Zac's instructions and nothing is working. Have contacted new host and there is no malicious code in the database nor the php. I believe the original host is at fault here, there is no other explanation. Thank you for your help, but it looks like I will have to rebuild the sites.

James Barnett
James Barnett
39,199 Points

Either re-build the sites or pay your new host to perform the restoration from backup for you.

Got it fixed. FYI: DO NOT USE FIND AND REPLACE as per the instructions given by Zac. This is also something that WordPress says to avoid as well. And delete the old .htaccess file.

James Barnett
James Barnett
39,199 Points

Aaron Hill -

Good job!

In your case you were restoring from backup so there's no reason to do a find & replace.

However, if you are changing domains from a dev domain to a production domain why wouldn't you use Find & Replace?

Oh, and re-index your permalinks.

James Barnett
James Barnett
39,199 Points

Sounds like you learned a lot :smile:

You should write up the steps you learned in a blog post or at least it's own forum post for future searchers to learn from your knowledge.

Because the entries in the database have key id's in the database. When you do a search and replace, you alter the key id's and that causes corruption of the database. Information was found on WordPress.org. When doing it on a test bed, you want to build it exactly as you want it to be found on the real world environment to avoid issues like this.

James Barnett
James Barnett
39,199 Points

When doing it on a test bed, you want to build it exactly as you want it to be found on the real world environment to avoid issues like this.

Not if you want that dev site to be publicly accessible for collaborators to see a dev version of the site if you a building a new version along side a current production site.