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 trialAaron Hill
3,983 PointsMigrating 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
39,199 PointsMy 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.
James Barnett
39,199 PointsIf 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.
Aaron Hill
3,983 PointsThank you, James. I will give Zac Gordon's instructions a try.
Aaron Hill
3,983 PointsStill 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
39,199 PointsEither re-build the sites or pay your new host to perform the restoration from backup for you.
Aaron Hill
3,983 PointsGot 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
39,199 PointsGood 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?
Aaron Hill
3,983 PointsOh, and re-index your permalinks.
James Barnett
39,199 PointsSounds like you learned a lot
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.
Aaron Hill
3,983 PointsBecause 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
39,199 PointsWhen 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.
Aaron Hill
3,983 PointsAaron Hill
3,983 PointsWell, 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
39,199 PointsJames Barnett
39,199 PointsThat's not compromised sounds like they are on a real-time spam blacklist.
Aaron Hill
3,983 PointsAaron Hill
3,983 PointsWell, 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
39,199 PointsJames Barnett
39,199 PointsIf 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.
Aaron Hill
3,983 PointsAaron Hill
3,983 PointsI 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.
Phillippa Christie
1,473 PointsPhillippa Christie
1,473 PointsHave you tried the duplicator plug in?