Migrations are a thing we have to do sometimes but dread doing. You ask yourself before, will it go okay? You think later, did I forget anything?
In this talk I’m going to give you some key insights into migrating information from WordPress.com to a WordPress.org self-hosted site. After we’ll discuss the details of migrating a production web site from one host to another. I’ll give you the tools to test the migration before completely flipping the switch. Lastly, we’ll talk about when you want to migrate content from a development copy of the site over to your production site.
1. On The Move
Migrations Debunked
Jonathan Perlman - @jpurpleman
WPCampus 2017
http://jpurpleman.ca/
2. About me
• Canadian, eh! Montreal, Quebec
• Senior web developer at Dawson College
• Teacher at Dawson College’s CTD ( non-credit )
• WordCamp speaker
• Excel super-geek as per
Chris Lema
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
4. What’s covered…
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
• WordPress.com to self-hosted
• General overview
• One-time transfer
• Continuous migration
• DNS
• Check your site
• Resources
11. Post Import
• Theme
o Theme Directory – https://wordpress.org/theme
o Custom development ?
• Plugins
o Plugin Directory – https://wordpress.org/plugins
o JetPack
o Custom development ?
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
13. What are we moving?
Code
HTML, CSS,
JS, PHP
Media
Library
JPG, PNG,
DOC, PDF
Content SQL Database
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
14. Doing the migration
• Login to old host and download the WordPress site and
export MySQL database
• Login to new host and create a MySQL database
• Change wp-config.php locally within the WordPress
installation files
• Upload the WordPress site onto the new host and import
MySQL database
• Change Site URL and Site Path within the database
• Change your hosts file and test the site
• Change the DNS and wait
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
15. Required Tools
• Command line ( SSH )
o tar, scp, sed
o vim
o wp-cli
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
• File Transfer Program
o FileZilla
• Database client
o phpMyAdmin
o HeidiSQL
• ( Windows only )
o Sequel Pro
• ( Mac only )
17. Doing the migration
• Login to old host and download the WordPress site and export
MySQL database
• Login to new host and create a MySQL database
• Change wp-config.php locally within the WordPress
installation files
• Upload the WordPress site onto the new host and import
MySQL database
• Change Site URL and Site Path within the database
• Change your hosts file
• Check your site on the new host for errors
• Change the DNS and wait
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
23. Exporting via command line
• WP-CLI
o wp db export
• Raw MySQL Command
o mysqldump -u root -pPASSWORD
--complete-insert
--skip-extended-insert
--max_allowed_packet=512M
-B site_edu > site_edu.sql
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
24. Doing the migration
• Login to old host and download the WordPress site and export
MySQL database
• Login to new host and create a MySQL database
• Change wp-config.php locally within the WordPress
installation files
• Upload the WordPress site onto the new host and import
MySQL database
• Change Site URL and Site Path within the database
• Change your hosts file
• Check your site on the new host for errors
• Change the DNS and wait
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
25. Login to the database
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
26. Create a new database
1 Create a New
database
2 Give the database
a name
o Lowercase
o No spaces – use
underscores
o No special characters
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
27. Listing users having access
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
29. Doing the migration
• Login to old host and download the WordPress site and export
MySQL database
• Login to new host and create a MySQL database
• Change wp-config.php locally within the WordPress
installation files
• Upload the WordPress site onto the new host and import
MySQL database
• Change Site URL and Site Path within the database
• Change your hosts file
• Check your site on the new host for errors
• Change the DNS and wait
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
30. Change wp-config.php
• Edit wp-config.php with a text editor
• Change lines ~ 23, 26, 29 start with "define"
/** The name of the database for WordPress */
define('DB_NAME', ‘');
/** MySQL database username */
define('DB_USER', ‘');
/** MySQL database password */
define('DB_PASSWORD', '');
/** MySQL hostname */
define('DB_HOST', 'localhost');
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
31. Doing the migration
• Login to old host and download the WordPress site and export
MySQL database
• Login to new host and create a MySQL database
• Change wp-config.php locally within the WordPress
installation files
• Upload the WordPress site onto the new host and import
MySQL database
• Change Site URL and Site Path within the database
• Change your hosts file
• Check your site on the new host for errors
• Change the DNS and wait
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
33. Importing via command line
• WP-CLI
o wp db import
• Raw MySQL Command
o mysql -u root -pPASSWORD
--max_allowed_packet=512M
site_edu < site_edu.sql
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
34. Doing the migration
• Login to old host and download the WordPress site and export
MySQL database
• Login to new host and create a MySQL database
• Change wp-config.php locally within the WordPress
installation files
• Upload the WordPress site onto the new host and import
MySQL database
• Change Site URL and Site Path within the database
• Change your hosts file
• Check your site on the new host for errors
• Change the DNS and wait
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
39. Doing the migration
• Login to old host and download the WordPress site and export
MySQL database
• Login to new host and create a MySQL database
• Change wp-config.php locally within the WordPress
installation files
• Upload the WordPress site onto the new host and import
MySQL database
• Change Site URL and Site Path within the database
• Change your hosts file
• Check your site on the new host for errors
• Change the DNS and wait
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
40. Override your DNS
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
http://www.howtogeek.com/howto/27350/
beginner-geek-how-to-edit-your-hosts-file/
41. Windows
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
• Using the Windows Logo use the Start Menu /
Screen and search for Notepad
• Right click Notepad and “Run as Administrator”
c:windowssystem32driversetchosts
42. Mac
• Use the app called GasMask from Clockwise
• Download
o http://clockwise.ee/
• Tutorial
o http://www.gilsmethod.com/how-to-edit-hosts-
files-in-mac-os-x-without-the-headaches
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
43. Doing the migration
• Login to old host and download the WordPress site and export
MySQL database
• Login to new host and create a MySQL database
• Change wp-config.php locally within the WordPress
installation files
• Upload the WordPress site onto the new host and import
MySQL database
• Change Site URL and Site Path within the database
• Change your hosts file
• Check your site on the new host for errors
• Change the DNS and wait
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
44.
45. White screen of death?
• Update all plugins, themes, and WP core
• Check php version changes
• Deactivate all plugins and reactivate them one-by-one
• Deactivate the current theme - switch to 2017
• Reset permalinks
• Check .htaccess file – Compare against the codex
• index.html & index.php
• .maintenance
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
46. White screen of death?
• Modify wp-config.php - add:
o define(“WP_DEBUG”, true);
o define( “WP_DEBUG_DISPLAY”, true );
• Check the error log
o Accessible via STFP
o CPanel
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
47. Doing the migration
• Login to old host and download the WordPress site and export
MySQL database
• Login to new host and create a MySQL database
• Change wp-config.php locally within the WordPress
installation files
• Upload the WordPress site onto the new host and import
MySQL database
• Change Site URL and Site Path within the database
• Change your hosts file
• Check your site on the new host for errors
• Change the DNS and wait
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
52. Plugin comparison
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Plugin Single Site vs Multisite Migrates what?
Duplicator
Single Site
Code
Media Library
Content
Backup Buddy
UpDraftPlus
Single Site
Multisite ( with Premium )
All-in-One WP
Migration
WP Migrate DB Pro
Single Site
Multisite
Media Library
Content
WP Site Sync
56. Pros / Cons
Pros Cons
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
• Super user friendly
• Export site to the cloud
• Automates the process
• Finds and replaces
• Not multi-site friendly
• Timeouts on larger sites
• Can’t use CloudFlare
while duplicating
• May require changes to
.htaccess
• Files might need to go in
non-standard directories