WordPress Migration Tips GoDaddy Hosting
Written by Igor Lubinets
When migrating a WordPress website to a development server make sure that your wp-config.php file doesn’t still point to the source website’s database.
Today, I want to tell you a story that happened to me, when I was still learning developing WordPress websites. I had a GoDaddy hosted website that needed to be copied over to a development server for modifications. I FTPed into the server, copied the files, I backed up the database into another file and moved that over as well. Everything was looking good. I search-and-replaced the database to match the new server. I was done, right? Everything was working on the new server.
So without thinking much of it, I started hacking on things. I deleted some posts, I modified some custom fields and options, installed a few extra plugins, ran some database optimizations, etc. Everything was good, until I accidentally looked at the web browser address bar to see that I was in the live website! How can that be? I thought. My heart was slowly sinking into my boots when I realized what had happened. ( brownie points for those who already know what I am about to tell you)
The root of the problem
When GoDaddy creates an instance of a WordPress site, it installs the actual application files and the MySQL database on different servers. So when you open the wp-config.php file you will see that the database entry doesn’t point to the localhost, but instead points to some absolute URI like http://secure.godaddy.wordpress,something.com/yourdatabase123 location. So, when we move the WordPress folder files over to the new server, our new installation still points to live database from above. And when we log into the new dev server, we are immediately redirected to the live site’s admin panel. It is an easy mistake to make if you are not familiar with the idiosyncrasies of specific website hosting setups.
How to avoid and fix the problem
This situation is easily prevented. All you have to remember is that any time you are going to do something with the live website, you ALWAYS want to back everything up first. Even if you think that nothing could ever go wrong in a certain situation, believe me, that is when it goes wrong. To fix my particular problem, all you had to do was
- run a full backup
- copy the files and the database to the new server
- edit the wp-config.php to make sure the database field is pointing to localhost or the new database location
That’s right, pretty easy. You need to develop a set of procedures that you can always follow no matter what, when tackling website migrations. That way you can protect yourself and your website from collapse.
Another way to solve this would have been to go with a managed WordPress hosting solution where you can just click a button and all a staging server will be set up for you automatically. But sometimes you inherit old websites, and don’t have a choice.
Hopefully, someone has found this post helpful.
Here at Webilect, I don’t use GoDaddy hosting. For the websites that I manage personally, I choose Digital Ocean’s VPS solutions. And for the websites that I don’t manage myself, I recommend using Flywheel or WP Engine.