Migrating your WP site to a new host

Once you have found a hosting provider that you are happy with, there are a lot of good reasons for staying with them. But nothing in life is permanent, and there may come a time when you need to move your website to a new hosting service.

As long as you are using your own domain name, the changeover can be transparent for your users, i.e. they won’t notice the change, except maybe for a short downtime.

But there are some things you need to do behind the scenes to make this happen. Here are a few of the items you should pay attention to. This is not meant to be a step-by-step guide to migrating a website to a new host; there are too many differences between hosting services to be able to provide a generic procedure. B ut I hope these few hints will be helpful for anyone who has to move theor WordPress site to a different provider.

  • Download all your uploaded images (i.e. the entire wp-content/uploads directory) and upload them to the new server.
  • When you set up your site on the new host, make sure the database table prefix is the same. You may not have control over the database name, and that is ok, but the table name prefix is defined in wp_config.php. It often is set to ‘wp_’, although that’s not always the case. Example:
/**
 * WordPress Database Table prefix.
 *
 * You can have multiple installations in one database if you give each a unique
 * prefix. Only numbers, letters, and underscores please!
 */
$table_prefix  = 'mydata_';
  • Make sure all the authorization keys are the same, so that the WP user passwords will work. The keys are also defined in wp-config.php. The example below is fictitious; actual keys are longer and much more random looking. Just copy the keys from your old wp-config.php into the new one.
define('AUTH_KEY',         'blahblahblahblahblahblahblahblahblahblahblahblahblah');
define('SECURE_AUTH_KEY',  'bla2bla2bla2bla2bla2bla2bla2bla2bla2bla2bla2bla2bla2');
define('LOGGED_IN_KEY',    'bla3bla3bla3bla3bla3bla3bla3bla3bla3bla3bla3bla3bla3');
define('NONCE_KEY',        'bla4bla4bla4bla4bla4bla4bla4bla4bla4bla4bla4bla4bla4');
define('AUTH_SALT',        'bla5bla5bla5bla5bla5bla5bla5bla5bla5bla5bla5bla5bla5');
define('SECURE_AUTH_SALT', 'bla6bla6bla6bla6bla6bla6bla6bla6bla6bla6bla6bla6bla6');
define('LOGGED_IN_SALT',   'bla7bla7bla7bla7bla7bla7bla7bla7bla7bla7bla7bla7bla7');
define('NONCE_SALT',       'bla8bla8bla8bla8bla8bla8bla8bla8bla8bla8bla8bla8bla8');
  • Export your database using phpmyadmin on your old site.
  • Edit the SQL export file before importing it into the new database. Change the DB name to the name on the new server. Add the DROP and CREATE statements if they are not there. Example:
DROP DATABASE IF EXISTS newdbname;
CREATE DATABASE IF NOT EXISTS newdbname DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE newdbname; 

That’s it for now. If you have any helpful suggestions to add to this list, please enter them in a comment below. Thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *