WorryFree Computers   »   [go: up one dir, main page]

Skip to content

Migrate an Existing Site

If you’d like to migrate an existing WordPress site to WordPress.com, you have a couple of options:

  1. Use a migration plugin.
  2. Manually transfer files using WP-CLI and rsync.

The first option is better for those who prefer a guided, hands-off approach. The second option grants more control over the process but requires a high degree of technical knowledge.

Use Our Migration Flow and a Migration Plugin

Go through our migration flow to effortlessly migrate an existing site to WordPress.com.

Migrate a WordPress Site Into an Existing WordPress.com Site

If you already have a WordPress.com site that you’d like to migrate an existing site into, follow these steps:

  1. Start your import.
  2. Select the WordPress.com site you wish to import into.
  3. Choose WordPress from the list provided.
  4. Enter the URL of the existing site you wish to migrate to WordPress.com.
  5. Install and activate the Migrate Guru plugin on your existing site.
  6.  Go to the Migrate Guru page on your source site, enter your email address, and click Migrate.
  7.  When asked to select a destination host, pick WordPress.com.
  8.  Copy and paste the migration key provided by WordPress.com in the Migrate Guru Migration key field and click Migrate.
  9.  Wait until we finish setting up your site to continue.

After the migration process finishes, you’ll want to verify everything on your site works as expected. Once you’ve confirmed, map the domain to the site and go for launch.

Migrate a WordPress Site Into a New WordPress.com Site

If you don’t already have a WordPress.com site but you’d like to migrate over to WordPress.com, follow these steps:

  1. Go through the checkout flow here.
  2.  Install and activate the Migrate Guru plugin on your existing site.
  3.  Go to the Migrate Guru page on your source site, enter your email address, and click Migrate.
  4.  When asked to select a destination host, pick WordPress.com.
  5.  Copy and paste the migration key provided by WordPress.com in the Migrate Guru Migration key field and click Migrate.
  6.  Wait until we finish setting up your site to continue.

After the migration process finishes, you’ll want to verify everything on your site works as expected. Once you’ve confirmed, map the domain to the site and go for launch.

Migrate a Non-WordPress Site to WordPress.com

You can leverage the instructions for importing a Non-WordPress site to WordPress.com from another CMS here. Simply choose the CMS you’re migrating from and follow our detailed instructions.

Manually Transfer Files

This guide will show you how to manually migrate your site using the rsync and ssh in Terminal.

Windows users: If you are an operating system other than macOS or Linux, such as Windows, then you will need to use an sFTP client to transfer your files instead of rsync. Connecting via SSH will need to be done using the PuTTY client.

Before you begin

There are a few things you’ll need to confirm before moving forward with a manual migration:

Confirm Database Charset

  1. Navigate to Site Health on the source site by going to Tools > Site Health.
  2. Click on Info and expand the Database section.
  3. If the Database charset is not latin1, then you will need to reach out to our support team by clicking the chat icon in the lower right side of this page, and request that the destination WordPress.com site’s database is converted to utf8. Note that this will erase all content on the WordPress.com site in preparation for the migration.

Already Have A Backup?

If you already have a backup of your site’s files and sql database on your computer, then you will want to move the backup folder to an easy to navigate folder, such as the home folder (You can navigate to this folder on a Mac in Finder by pressing SHIFT + COMMAND + H on your keyboard).

For the purpose of this guide, we’ll assume the folder is renamed to wpbackup, so the full path would be ~/wpbackup/. Inside the wpbackup folder should be the wp-config.php file and wp-content folder, along with the SQL file.

  • Locate the SQL file(s) in ~/wpbackup/. If tables were previously exported as separate SQL files in a subfolder such as ~/wpbackup/sql/, then we can combine them by running the command:
    cat *.sql > database.sql
  • For the remainder of this guide, we will assume that the SQL file is located in ~/wpbackup/sql/database.sql.

If you already have a backup, you can go directly to the Prepare the WordPress installation folder section.

Export the source site’s database

Next you will connect to the source site via SSH to export the database.

  1. Connect to your site via SSH in Terminal. If you are unsure of how do this, you may need to refer to your host’s support for instructions.
  2. Locate the site’s WordPress installation folder. This is usually in a folder called public_html or htdocs, and is easily identifiable as the folder that contains the wp-content folder. You may need to use the ls command to browse the contents of each directory you navigate.
  3. Once you have located the WordPress installation folder, use the cd command to navigate into that folder.
  4. Create a folder called sql by entering mkdir sql.
  5. Export the database to the new sql folder by entering wp db export sql/database.sql.

Identify the WordPress Install path

  1. While in your WordPress installation folder, you can output the WordPress Install Path by typing pwd. Make note of this path for the next section.
  2. Terminate the SSH session by entering exit.

Transfer & Prepare the WordPress installation on your computer

At minimum, to perform the migration, the following will be required:

  • SQL file of the database.
  • wp-content folder containing your sites themes, plugins, and media files.

Transfer the WordPress installation to your computer

Transfer the WordPress installation from your source site to the ~/wpbackup/ backup folder on your computer with rsync using the following command:

rsync -avz -e 'ssh -p [port]' --exclude 'advanced-cache.php' --exclude 'object-cache.php' --exclude 'jetpack/' --exclude 'akismet/' --exclude 'full-site-editing/' [ssh_username]@[remote_server]:[wordpress_install_path]/ ~/wpbackup/
  • Replace [ssh_username] with your actual SSH username and [remote_server] with the remote server’s hostname or IP address.
  • Replace [wordpress_install_path] with the actual path to your WordPress installation on the remote server.
  • Replace [port] with your remote host’s SSH port. This is usually 22, however, some hosts like SiteGround use a non-standard port.

Prepare the WordPress installation folder on your computer

  1. Core WordPress files are symlinked on WordPress.com and cannot be overwritten. To upload your WordPress install to WordPress.com, you will need to delete the following core WordPress files from ~/wpbackup/:
    • /wp-admin/
    • /wp-includes/
    • index.php
    • wp-activate.php
    • wp-blog-header.php
    • wp-comments-post.php
    • wp-config-sample.php
    • wp-cron.php
    • wp-links-opml.php
    • wp-load
    • wp-login.php
    • wp-mail.php
    • wp-settings.php
    • wp-signup.php
    • wp-trackback.php
    • xmlrpc.php

You can also easily delete these files using the following terminal command:

rm -rf ~/wpbackup/wp-admin/ ~/wpbackup/wp-includes/ ~/wpbackup/index.php ~/wpbackup/wp-activate.php ~/wpbackup/wp-blog-header.php ~/wpbackup/wp-comments-post.php ~/wpbackup/wp-config-sample.php ~/wpbackup/wp-cron.php ~/wpbackup/wp-links-opml.php ~/wpbackup/wp-load.php ~/wpbackup/wp-login.php ~/wpbackup/wp-mail.php ~/wpbackup/wp-settings.php ~/wpbackup/wp-signup.php ~/wpbackup/wp-trackback.php ~/wpbackup/xmlrpc.php ~/wpbackup/wp-content/advanced-cache.php ~/wpbackup/wp-content/object-cache.php
  1. Rename wp-config.php to wp-config.php.bak by running the following command:
mv ~/wpbackup/wp-config.php ~/wpbackup/wp-config.php.bak

Perform the Migration

Enable SSH

Enable SSH on the destination site on WordPress.com.

Upload Files and Folders

Note: For the following terminal commands, replace [sftp_username] with the sFTP username found in Hosting Configuration.

  1. Upload all files within the root backup folder, excluding the wp-content folder using the following terminal command. This should include the SQL file/folder, wp-config.php.bak, and any other files/folders in the root WordPress installation folder:
rsync -avze ssh --exclude 'wp-content/' ~/wpbackup/* [sftp_username]@sftp.wp.com:htdocs/
  1. Upload the wp-content folder excluding themesplugins, and uploads folders:
rsync -avze ssh --exclude 'themes/' --exclude 'plugins/' --exclude 'uploads/' ~/wpbackup/wp-content/* [sftp_username]@sftp.wp.com:htdocs/wp-content/
  1. Upload the themes folder:
rsync -avze ssh ~/wpbackup/wp-content/themes/* [sftp_username]@sftp.wp.com:htdocs/wp-content/themes/
  1. Upload the plugins folder:
rsync -avze ssh ~/wpbackup/wp-content/plugins/* [sftp_username]@sftp.wp.com:htdocs/wp-content/plugins/
  1. Upload the uploads folder:
rsync -avze ssh ~/wpbackup/wp-content/uploads/* [sftp_username]@sftp.wp.com:htdocs/wp-content/uploads/

Update wp-config.php & Import Database

  1. Open ~/wpbackup/wp-config.php.bak in a text/code editor such as Atom.
  2. Make a note of the $table_prefix value. If it is anything other than wp_, then we will need to update the wp-config.php file on the destination site:
    • SSH into the site via terminal by running ssh [sftp_username]@sftp.wp.com.
    • Open wp-config.php by running nano ~/htdocs/wp-config.php
    • Update the $table_prefix value to match the value from ~/wpbackup/wp-config.php.bak.
    • Press CTRL + X on your keyboard to close the file. When prompted to save the file, press Y then RETURN.
  3. SSH into the site if you haven’t already, and run wp db import ~/htdocs/sql/database.sql
  4. Run wp cache flush.

Post Migration Steps

Activate Jetpack and Akismet

  1. While SSH’d into the site, run the command wp user list --role=administrator. If an administrator account with an email that matches the email found in your WordPress.com Account Settings is not present, then you will need to add it by running:
wp user create [username] [email] --user_pass=[password] --role=administrator
  • Replace [username] with your WordPress.com username.
  • Replace [email] with your WordPress.com account email.
  • Replace [password] with a strong password.
  1. Activate Akismet and Jetpack by running wp plugin activate akismet jetpack. This is required, as these plugins need to be active in order for your site on WordPress.com to function correctly.
  2. Log into your site’s WP Admin using your WordPress.com email.
  3. Once logged in, click on Jetpack from the menu on the left, then click “Set up Jetpack”. When prompted, click “Approve” to authorize the connection with your WordPress.com account.

WooPayments

If your site uses WooPayments as your WooCommerce Payment Gateway, then we will need to relink the WooPayments account to your site here at WordPress.com. Please contact our support team by clicking the chat icon in the lower right hand side of this page.

Last updated: May 31, 2024