Moving WordPress to new host

wpSometimes it’s time to say goodbye. To a Web Host for example. But we want to take our beloved WordPress website with us. If the relocation is urgent (for example because the old host charges a ridiculous yearly fee) this can cause quite some stress. Calm down. Here is a short list of how to move any WordPress site in no time. Prepare some coffee and just follow these steps.

  1. Grab your files. I normally use SFTP to copy the files from my old host to my new host. This takes about 5 minutes if your WordPress installation is not too large. Transfer mode “auto” should be fine. In case you have a lot of large plugins installed you could use yet another plugin to backup your files and download them as a zip, that you upload to your new host later. (Of course, if you have shell-access to your server, you can use that).
  2. Grab your database. Your old host should provide access to a tool like PhpMyAdmin, where you can export the database. Just use the standard options and save the .sql file.
  3. Upload your files. Create a new directory in the root of your new web space and place the files there. You can of course copy them directly from one FTP site to another using a smart FTP client. (I install the site on my localhost WAMP server before I transfer it to the target).
  4. Create a (sub)domain. Your new web host has a web interface such as Plesk, where you create a new subdomain, or order a new domain. They should notify your old host and take care of domain registration. You map that (sub)domain to the directory created in the previous step.
  5. Create and upload the database. In the same web interface, you create a new database. Choose a password. Write down database name, username, and password. Use Import to import the .sql file you downloaded previously.
  6. Change your wp-config.php. You enter at least the following information:
    database host (often, but not always, localhost
    database name
    user name
    password 
  7. Change permalink structure. If you visit Settings > Permalinks, WordPress should automatically update your permalink structure, if you change the setting and save it. In my case, this didn’t happen, so I changed it directly in the MySql database using the following SQL statement (careful):

    UPDATE wp_posts
    SET guid = REPLACE (guid,'[old-url]', '[new-url]')
    WHERE guid LIKE '[old-url]'

    Replace [old-url] and [new-url] with the names of your urls.The WHERE-clause is not necessary, but added in case for whatever reason you have links to external pages in your database, that should not be changed.

All set. You have moved your WordPress installation. You might want to test it first, and fine-tune the settings of your plugins, particularly the ones handling caching and SEO.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.