Transcript of "WordPress Migrations - Moving WordPress to Another Server"
You may have to do one or all of the following to
move a WordPress site from one server/folder
Physically relocate the files (PHP, images etc.)
Physically relocate the database (SQL)
Reconfigure WordPress to point to new database
Rename URLs in database from old domain/folder
to new domain/folder
FTP = “File Transfer Protocol”
– PRO: Has been around since dawn of Interwebs
– PRO: Vastly supported
– CON: Two channels. One for data, one for control. Bit of overhead
– CON: No encryption. None. Nadda. Tiddly Squat. Zero! N O T H I N G
Try to avoid using FTP where possible.
However, most shared hosting plans do not support secure FTP
WTF is that all about?
Two completely different methods!
FTPS = “Secure FTP”
Uses two data streams. One for data + one for control
SSL encryption. Widely supported.
SFTP = “SSH File Transfer Protocol”
Uses one data stream for both control and data
Requires SSH keys management. More secure.
Command line :-P
Has a global password to protect accounts
PHPStorm and Dreamweaver have built in FTP clients
1. At old location, pack existing site into a compressed archive
2. Download archive file to local machine
3. FTP archive file up to new location (securely if possible)
4. Unpack archive file at new location
Congrats - Your WordPress site files are now at the new location.
Two Considerations before attempting to move the database
1. “Am I moving the database to a new database server?”
Will mostly be yes.
2. “Am I moving the site to a new domain or folder structure?”
If so, you will also need to rename the old domain URLs that
are stored in the database, to your new domain
URLs in your content or links to images/resources on your posts
and pages are stored in the database.
Some, URLs will be stored along with other related information
(e.g post/media ID, attributes) – an array of information
Arrays are stored in the DB as serialized data.
s:26 = number of characters in the string
By simply renaming URLs in the SQL file using a text editor, the
number of characters in the string will be incorrect and that will
cause data issues. You need to update both.
• Renames URLs in serialized data
• Save DB file as SQL or sql.gz
• Pull/Push directly to DB server
• Detects environmental limitations to avoid failures
• Select whatever tables you want to migrate
• Sync media files
Upload the sql.gz
file that was
generated by WP
PHPMyAdmin or PHP environment may have upload limitations.
1. Use SSH
mysql –u username –p database_name < file.sql
or for a .sql.gz
zcat file.sql.gz | mysql -u username –p database_name
2. Use BigDump script
3. Split SQL file into manageable chunks
Not recommended. Easy to break SQL statements.
1. Use WP Migrate DB
Rename old domain to new
2. Generate .sql.gz file
3. Load into blank DB using
Last thing to do is to tell WordPress where the database is
Edit the wp-config.php file
Read Japh’s “Migrating a Site Quickly with SSH and WP-CLI”
– scp ./* email@example.com:~/limeca/wordpress
WP-CLI “a command line interface for WordPress”
– wp db export - l gzip > database.sql.gz
– wp core download
– gunzip < database.sql.gz | wp db import
– wp search-replace olddomain.com newdomain.com
– then edit the wp-config.php file
XCloner Plugin (free) http://www.xcloner.com/
OK – if you’re not changing domain or URL structure i.e. “cloning”
BackupBuddy (paid) http://ithemes.com/purchase/backupbuddy/
Using the “Move” feature. Deploy to a new domain.
Git (free) http://git-scm.com/
From “master” branch, pull on or push to server.
Doesn’t do the DB though on its own (use hooks)
When moving your site watch out for…
.htaccess file (hidden file in your site root folder)
– This file is used for caching and permalinks. It may contain references
to your old domain/URL structure.
If in doubt, don’t move it to the new server and let WordPress create
a new one by saving your Permalinks settings in the moved site.
– These may also use the .htaccess file to add rewrite rules which may
contain the old domain/URL structure. Disabled them before the
move and then activate them again on the new server.