It feels like a horrible day when you move your WordPress blog onto a different server, maybe after you’ve been testing it on a local server, open up the home page url, and … there’s nothing there. You can’t log in to the admin centre because, well, it’s not there either!
Here’s the seven steps to moving your WordPress site onto a different server, and making it work.
Back up the site files and the database. It’s obvious, I know.
Load the database onto the new server, keeping the database name and user the same.
Load the site files onto the new server.
Edit the functions.php file to update the site url.
Your functions.php file is in the wp-content -> themes -> yourthemefolder.
If you don’t have a functions.php file in there you can just create one with the
Put the following code into your functions.php file, and re-upload it to the site:
This tells WordPress where to look for the siteurl, even though the database contains the previous url. When the WordPress settings detect it, the database content is updated with the new url. (Once you’re up and running you should comment this out as the WP settings page will take over).
Check all is well by reviewing “WordPress Address (URL)” in General Settings in wp-admin at the new site’s url.
To avert permalink misbehaviour, use a WordPress plugin to edit the internal urls. A convenient plugin for this is “Velvet Blues Update URLs”. Once it’s installed, you’ll find it in wp-admin’s Tools. Enter the old root url and the new one, and off you go.
Then go to Permalinks in WP Settings, and set the permalinks to Plain to reset everything. You can change them back to your preferred setting later, if you wish.
Check internal links are working properly. If you’ve added any to site files in your theme (such as a splash page), you will need to edit them and re-upload the files.