How to Migrate WordPress Blog – A Step By Step Guide
In some situation, we may want to copy our whole wordpress blog then install it in a new place, or in other word migrate the wordpress blog to another server, either local or live server. This can be done manually by copy and paste directly, but by using this way, there are many things that we have to do afterwards, such as resetting the database, update url in all contents, reset the plugin, etc., it may troublesome for some people, so in this tutorial we will discuss about how to easily copy / migrate wordpress blog, especially using duplicator plugin, almost all that we have to do manually will be done automatically by this plugin. df
How it works is that the plugin will copy/clone entire site (both files and database) then store it in a package (zip archive file). The package files can be installed to any server, either local server (localhost) or live server, without having to install wordpress first. Some possible migration:
- From live server to localhost
- From live server to another live server
- From localhost to live server
- From localhost to localhost
This tutorial will walk you through the step to migrate from live server to live server/localhost, although it can also be applied to all of the above possibilities.
1. Install Duplicator Plugin
To be able to use this plugin, of course, we have to install it first, to do so, log in to wordpress then navigate to menu: Plugins » Add New, search the plugin by entering a keyword “duplicator” (without quotes) in the search field.
Install and activate it. Once it activated, it will display a new menu named Duplicator, located on the left sidebar.
2. Create New Packages/Snapshot
Once the plugin is installed, the next step is create a package/snapshot of our whole wordpress site, to do so, hover on Duplicator menu and then click on the Packages submenu, in the packages page that appears, click Create New button and fill in the package details.
Add new packages
Fill in the package details
The installer fields will be used as the default parameter when we install the package to a new place. This field is optional, you may leave it blanks.
In the above example, the new package will be stored in the wp-snapshots directory from the root folder.
Excluding folder and files
You can exclude all folders that you don’t’ want to include, but for excluding files, the free version only let you filter it by file extensions (.log, .bat, etc), to be able to filter the individual files, you must use the paid version.
To filter a folder, click on the Archive box, then click Files tab, check on the Enable File Filters and write down the directory path and file extensions that we want to exclude, note that the directory path must be absolute, usually beginning with /home (for live server), to reference the path of the root folder you can click on the Storage box.
The above example will exclude myfiles folder which is located in public_html folder and backups folder which is located in wp-content/uploads folders, and it also not include all the files with .log and .bat extension
Excluding Database tables
To exclude database tables, click on the Archive box, then click Database tab, check on the Enable Table Filters then choose the tables that you want to exclude.
Once finished, click Next, then duplicator will scan the system to analyze files and database to be stored in the package, the result as shown in the following figure:
3. Build Package
The next process is build the package, the plugin will store all of the files that we have chosen and save it into an archive file (.zip), time required to finish the process depends on the number and the size of files, once completed, installer.php and an archive (.zip) file are created, both are required to install the package to a new place, to download them, click on the Installer and Archive button.
So far we can use the installer.php and archive file as a full backup, you can restore it anytime.
4. Install to A New Place
The package can be installed anywhere, either in a local server (localhost) or another live server, in this tutorial, we will install the package created by the duplicator plugin to live server or localhost. First, copy the package files (installer.php and .zip) into root directory, usually public_html, or htdocs in a local server, note that both files file must be in the same directory.
Step 1. Deploy Files & Databases
Run the installer file by navigate to url: http: //mynewwebsites.com/installer.php (live server) or http: //localhost/installer.php (localhost), then fill the existing parameters.
There are two options in the action field, both will affect the process of database manipulation:
- Create New Database
Means that the installer will create a new database, if the database already exists then it will trigger an error, test it by clicking on Test Connection.
- Connect and Remove All Data
If we select this option, first, the plugin will empty the database and fill it with new data tables, note that if we are on live server, NOT all hosting provider allow you to delete the database via PHP Script, therefore, the first option si more suitable.
Click Test Connection to ensure that the installer can connect to the database server and no errors occurred, then click Run Deployment, a warning window will pop up, just click OK and wait until the installation is complete.
Step 2: Update Files & Databases
In the next step, we’ll update some old data (url and path) such as the URL for the home page, post, page, archive, etc to the new one, the installer will change it in all locations both files and database tables.
Click Run Update and wait until the process is completed
Step 3: Test Site
After the update process is completed we will be taken to a summary page, pay attention to the 1. Reviews Install Report link, this link contained Errors and Warnings. The following example shows us that there are 10 errors in the update process.
Although triggered an error message, probably it’s not really an error, it is only to ensure that the update process is going well.
To see the errors messages, click 1. Review Install Report and then click Step2: Update Errors, to ensure that the errors really occur, go to phpMyAdmin and select the database (in this example: xtz_43254) and run SQL commands that appear in the error message, check whether the url has changed. In this example, after checking the database tables, known that the old URLs has been changed to the new ones, so there is no error occurred.
After the installation process is complete, the important thing to do is to delete installer.php, installer-data.sql and installer-log.txt files, because these files contained sensitive information that can harm your website. These files created during the installation process and located in the root directory.
Migrating wordpress blog could be done easily and quickly using Duplicator plugin. The plugin will create snapshots of the entire site into an archive file. The snapshot could be installed anywhere, either a local server (localhost) or live server, in addition, the archive can also be used as a backup file.