WordPress site migration, copying your site and moving it

There are several reasons why you might want to copy your website,

  • you want to make a “sandbox” copy to experiment on, without affecting the public-facing production site
  • you want to change hosting companies to get a better deal, faster performance or more functionality
  • having a complete copy of your website is a great insurance policy should something happen to your host and your site is lost.

wordpress-explained

If your site uses WordPress then just copying the files in your account is not sufficient. Since WordPress stores almost all of your site’s content in a MySQL database, you have to copy that too.


Manual WordPress Backup and Migration

Just copying your Posts and Pages

WordPress includes Export/Import tools that create and use an XML file to make a copy of your site. The drawback of this method is that it does not copy your themes, plugins, or preserve your menus and widget settings. But it is a quick method to grab and move your WordPress website contents.

First you export an XML file from the original site. The tool downloads this to your computer. Then using the import tool you upload that same file. During the import process you can choose to have the new site find and copy all the images you used on your posts and pages and add them to the Media Library of the new site.

These tools are in the Tools section of the WordPress dashboard

tools_import_1

tools_export_1

tools_import_2


Making a complete copy of your website including the themes, images, and plugins and all your configuration settings

1. First install a new copy of WordPress in the location you want for your new site.

Many website hosting companies offer a “one-click” install of WordPress that creates all the files and the database you need.

2. Copy the files, images, themes, and plugins you’ve added to your existing website.

WordPress site migration, copying your site and moving it 1All of the image files you’ve inserted into your posts and pages are stored in a directory in the file system. Also, the themes and plugins you’ve added are also stored in the file system. So the next thing to do is make a copy of the /wp-content/ subdirectory in your WordPress website directory. The wp-content directory includes the /themes/, /plugins/, and /uploads/ directories, and the /uploads/ directory is where all your images are stored. You have to have file manager access to your hosting account either through the hosting company control panel via a browser, or via ftp access using an ftp application like Filezilla. 

Make a copy of the directory and download it to your computer

3. After you make a copy of the /wp-content/ directory you replace the wp-content directory in new location with the copy from your old site. This will get you all your images, themes, and plugins, but not your posts, pages, menus, user accounts, or any of your configurations and settings. Those are all stored in your database.

WordPress site migration, copying your site and moving it 24. Make a copy of your database

Most of your text and configurations are stored in the WordPress MySQL database, so next we need to copy the database.

There are several methods that will do this.

1. You can export the database using your host’s control panel phpMyAdmin utility
2. There are several backup plugins that will make a copy of your database. BackWPup (free) and BackupBuddy (not free) are a good for this.

You will download the exported .sql file to your computer

4. Replace the new website database with  your exported database

Just as you used phpMyAdmin utility to export your existing database, you use the same utility to empty the default tables in the new database and import your .sql file to replace the default data from the new WordPress installation.

But before you can import the data from your old site you need to get rid of the existing data. This is called “dropping” the tables. You select all the tables then select Drop from the menu.

phpmyadmin-drop-tables

After you Drop the tables you have an empty database ready to import your old website data. Use the Import link to begin the process and upload the .sql file you saved to your computer. Once this is uploaded you’re almost done.
Portable-phpMyAdmin-List-Of-Database-Tables-1024x512-5
5. Edit the location of your new website in the database

Since you now have an exact copy of the old site there are a couple of problems. WordPress still thinks it is located  at the original URL. You have to select the “Options” table in the new database and edit records #1 and #37 which tell WordPress where it lives.

You will see the old URL in those fields. Replace with the new URL and save. At this point you should be able to go to the new URL and see your old website with everything in place. But there may still be one more problem. If you have internal links in your posts or pages linking to somewhere within the website those will still point to the original URLs. You have to install a Search and Replace plugin to find all the instances of your old URL in the database and replace those with the new URL.

After you have finished this go to your Settings>Permalinks in your dashboard and just Save. This refreshes the permalink settings for the new URL.


 Moving your site using a Migration Tool plugin

As you’ve seen above, copying and migrating manually is possible, but is detailed and exacting. There are multiple steps and making a mistake anywhere along the way will cause the process to fail. But there are a couple of plugins that automate the process.

DuplicatorBackupBuddyWordPress site migration, copying your site and moving it 3 costs $80 and Duplicator is free. For copying and migrating your WordPress website they work almost exactly the same. They create a “package” which includes all your files from your wp-content directory AND all the WordPress files too. They also create an installer.php file you use to migrate the site.

Here’s how the process works.

  1. Install the plugin of your choice.
  2. Run the plugin to create a package and installer file and download those to your computer.
  3. Create a MySQL database for the new location (this is the most technical part of the process, you need an empty database and you need to know the database name, database user name, and password).
  4. Upload the package and installer files to the new location.
  5. Run the installer.php program at the new URL. It will ask you to verify the new URL and what the new database credentials are (from #3 above).
  6. The installer program then unpacks all the WordPress files and all your data, imports all the content, themes, plugins, configuration and settings into the wp-content folder and the database, and then changes all the URLs from the old site to the new location!
  7. It’s still a good idea to go into the new site and update the Permalink settings. But other than that, you’re done.

The first time you do this, give yourself an hour. But after that it usually takes about 15 minutes. I do this frequently and in most cases prefer using the Duplicator plugin.

(This post was viewed 627 times) in the last month.)

Pieter Hartsook

WordPress website coaching, design, implementation, support, and training. Background in Marketing Research and Communications. See my profile at: https://www.linkedin.com/in/hartsook/

Reader Interactions

Comments

  1. Reading this on the heels of your previous GoDaddy article and thought I should mention, BackUp Buddy does not work in GoDaddy environments and the plugin makers do NOT refund purchases.

    Does Duplicator work in shared hosting environments? Particularly GD?

  2. Well according to GoDaddy tech support “all backup plugins are blacklisted for the WordPress Managed Hosting sites”. But I went ahead and installed Duplicator, ran it, and downloaded a full backup. They might remove the plugin (I left it on the site in a deactivated state to see) but they intend to roll out a good backup and restore solution by the end of April 2014 (see my post about the backup situation)

  3. August 2014 – The godaddy customer support advised using Duplicator on the managed wordpress wouldn’t run correctly as the content on the godaddy managed wordpress solution is hosted in a way that converts the uri strings so that they’re more secure. Duplicator cannot read these correctly.

    Instead simply go to the managed wordpress gateway and click ‘create from existing site’. Then install all the contents from the domain you want (enter the domain name, admin username etc plus SFTP details as requested).

    This adds the content to a temporary domain. Last bit then is just amend the primary domain on it to whatever you need to. Job done!

Leave a Reply

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

Limit search for phrases by using " " around the phrase

Signup for Monthly Email Notification

Get notified of new posts from WordPress Website Coach. We only send these out once on the 1st of each month.

Something went wrong. Please check your entries and try again.

Recent Code Snippets

Bulk remove posts from category 4

Bulk remove posts from category

Posted in ,

After creating a child category I wanted to remove the parent category from 30 posts. I finally searched for “how to remove a post category in bulk edit in wordpress” and and lo and behold the second result led me to this plugin. It works perfectly. I’m only sorry I […]

Read More
wizard of oz lions, tigers, and bears

Privacy, Cookies, & ADA Compliance — Oh My!
— Privacy Pt. 1

Posted in , , , ,

With more and more privacy laws on the horizon, we advise all of our clients to not only have a Privacy Policy in place but also have a strategy to keep it up to date with newly required disclosures. An up to date Privacy Policy can help you avoid significant […]

Read More
Elementor vs Beaver Builder review

Elementor vs Beaver Builder review

Posted in , , ,

I came across an Elementor vs Beaver Builder comparison review that was published in August 2020. While I am pretty biased in favor of the Beaver Builder platform the reviewer seemed to favor Elementor. If you are trying to decide which page builder platform to use I’d encourage you take […]

Read More
Mix and Match your RSS feeds 5

Mix and Match your RSS feeds

Posted in , , ,

Ever want to provide your readers with email updates to your website? WordPress’ built in RSS feed functionality provides an easy way to provide the content to email newsletter services like Mailchimp or Mailerlite. But what if you want to create email updates that don’t include all your new posts, […]

Read More
Online GIF tools for regular and animated GIF images 9

Online GIF tools for regular and animated GIF images

Posted in , ,

I made an animated gif screenshot recording to demonstrate a code snippet, but I wanted to resize the image and make it loop. I found a useful website that has easy tools to do that. I reduced the size by 50% and made it auto-loop 30x. Then optimized it to […]

Read More
When should I NOT use WordPress for a website 12

When should I NOT use WordPress for a website

Posted in , , , ,

click the green switch at the top of the screenshots to compare the WordPress vs the Static HTML versions of the same website the static version is live at: http://halcyonlearning.com/ (This post was viewed 147 times) in the last month.)

Read More

Popular Posts


Categories

Skip to content