12 Steps to Migrate a WordPress Site

12 Steps to Migrate a WordPress Site

[vc_row][vc_column][vc_column_text]Here is my step-by-step process for migrating a WordPress web site from a working or development server (sandbox) to its permanent server. This process does not make use of plugins and avoids the need to edit the database.

Before I moved a WordPress web site for the very first time, I prepared for the move by doing a lot research, culling information from the WordPress Codex and  elsewhere. From that research I developed a which resulted in a successful, glitch-free migration. I hope it saves you time and questions. I’ve included links to my key resources at the end of the article.

First, some definitions:

  • Working server: this is where you developed the web site (the sandbox).
  • Target server: the server you’re moving the web site to (its permanent home).
  • FTP client: the application you use to access the back door of a web site on your server. I use Fetch. Several of my colleagues use CyberDuck or FileZilla.

Step 1.

Turn off custom permalinks. In the WP dashboard on the working server, go to Settings>Permalinks and select the default button. Save.
Once in the new location, you will return permalinks to their original settings (Step 10).

640px-options-permalinks

Step 2.

Create a back-up of the working site’s content folder. Use an FTP client and download the wp-content folder to your computer.

Step 3.

Make a copy of the wp-content folder you just downloaded. This is a safeguard.

Step 4.

Create a backup of the working site’s database. On your working server, go to the phpMyAdmin (MySQL), locate the database used by the working WordPress web site, make a back-up file of it, and download the backup to your computer.

Step 5.

Make a copy of the database file you just downloaded. This is another safeguard.

Step 6.

On the target server, install WordPress if it is not already installed. This can be done from the admin area on the target server (this requires the files be zipped), or by uploading the unzipped files with your FTP client. The install process should include setting up a username and password. You’ll need these for Step 10 and subsequent site management.

Step 7.

Using your FTP client, upload the wp-content folder (from your desktop per Step 2) to the target server. Put it into the same directory where WordPress exists. It will overwrite the wp-content folder that was part of the install.

Step 8:

Upload the database file (from your desktop per Step 5) to the target server. On the target server, go to phpMyAdmin and upload the database from your computer. This is done via the “Import” tab. Note: you will not edit this database.

Step 9:

Using your FTP client, go to the functions.php file in your theme folder (inside the wp-content folder) on the target server, click on Edit and add this line of code at the bottom. Replace new-site-address.com with the new domain:

update_option(‘siteurl’,’http://www.new-site-address.com’);update_option(‘home’,’http://www.new-site-address.com‘);

The database must be edited with the URLs of the target server and domain in order for the site to function correctly in its new home. You can edit the database directly (not recommended), use a search-and-replace software, or use this update_option code.

Using the update_option function means that you don’t need to edit the database directly to fit the new server or URL. It updates the URL settings in the database all by itself.

Step 10:

Test. Log in to the WordPress dashboard on the target server and change the permalinks back to their original settings. Remember to save. Load your new site in your browser and test everything. NOTE: You may need to clear your browser cache or refresh the browser window in order to see the migrated site. Check and verify all of the links.

Step 11.

Delete the update_option lines of code that you added in Step 9. Once your site has loaded for the first time and you’ve checked and verified all the links, return to the functions.php file in the theme folder and delete the lines you added. They are no longer necessary, and keeping them may affect load and refresh times.

Step 12.

Take care of back-end details: SEO, Akismet, site map, payment gateways, etc. I hold off on installing certain plug-ins until the web site is happily ensconced on its permanent server. Again, check and re-check all links, plugins and functions before pronouncing it good to go. Once it’s running smoothly, you can delete the original site from your development server.

Additional Resources
http://www.siteground.com/tutorials/wordpress/change-url.htm
http://codex.wordpress.org/Moving_WordPress


[/vc_column_text][/vc_column][/vc_row]

Alvalyn Lundgren

Alvalyn Lundgren is the founder and design director at Alvalyn Creative, an independent practice near Thousand Oaks, California. She creates visual branding, publications and books for business, entrepreneurs and authors. She is the creator of Freelance Road Trip — a business roadmap program for creative freelancers. Contact her for your visual branding, graphic and digital design needs. Join her on Twitter, Facebook, Instagram, and subscribe to her free monthly newsletter.

This Post Has 4 Comments

  1. Hi Alvalyn,

    Thanks for these tips!

    Unfortunately they don’t seem to work ( anymore? ) or I am doing something wrong ( most likely haha ).
    I wonder if you would point me in the right direction?

    I did all the steps untill step 9 succesfully and in the order you discribed.
    However after step 8 I have a fresh install and can see all my plugins, my parent and child theme ( woothemes canvas ).
    Here is where I don’t know in what theme to put your code?

    Do I put it in the theme that was activated on install ( twenty fifteen ) or do I put the code in my Canvas parent or in my child theme?

    I tried switching to my parent theme and as soon as I put your code into its functions.php I get a nice white database error page.
    Removing the codes gets back the parent theme working, but no pages are migrated so…

    This is where I tested the manual migration: http://logologics.nl/manueelcur/

    So the code I inserted was:

    [code language=”css”]
    update_option(‘siteurl’,’https://wordpress-online-cursus.nl/’);update_option(‘home’,’http://logologics.nl/manueelcur/‘);
    [/code]

    Tried in in the twenty fifteen as well and get this error:

    Parse error: syntax error, unexpected ‘language’ (T_STRING), expecting ‘]’ in /home/logolo2b/public_html/manueelcur/wp-content/themes/twentyfifteen/functions.php on line 356

    I would appreciate if you could help me out?

    Thanks,
    Annie

    1. Try it this way:

      update_option(‘siteurl’,’https://wordpress-online-cursus.nl/’);update_option(‘home’,’http://logologics.nl/manueelcur/‘);

      (without the shortcode brackets)

  2. Hi Alvalyn,

    Thanks for trying to help me out here!

    I have put this code:
    update_option(‘siteurl’,’https://wordpress-online-cursus.nl/’);update_option(‘home’,’http://logologics.nl/manueelcur/‘);

    into the Twenty Fifteen ( so not my actual parent theme or child theme but the twenty fifteen that was installed with the fresh install )

    but still get this error:
    Parse error: syntax error, unexpected ‘:’ in /home/logolo2b/public_html/manueelcur/wp-content/themes/twentyfifteen/functions.php on line 356

    Thanks,
    Annie

    1. Check your syntax. Be sure the URLs are correct. Be sure you’ve edited the functions.php file for your active theme. Be sure you’ve refreshed your browser once or twice. If everything is correct, the site should show up properly.

      You can find more information here:

      I am not a technical support provider. Please consult the WordPress Codex (linked above) or your server’s WordPress support team.

      Thanks.

Leave a Reply

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

Close Menu