Websites & Hosting

Blog

Introduction

How we will migrate a WordPress site in matter of minutes. I have moved WordPress web sites a thousand times or more, most of the time I moved WordPress sites the old school way. That means moving the websites to a new host or server manually.

I also used migration services when testing web hosts, especially when it is free and they do a good job most of the times. However most of them are using plugins to migrate, some of the big players made their own plugin to move web sites.

I have tried even plesk migrator to migrate websites, they sometimes work. It takes a long time, so long I think I better had done it manually. The reason why I never used plugins is that I used to move huge sites with large databases. The servers timed out when trying to import databases. That is why I mostly did it old school.

I have investigated and tried many of them and today I want to try Duplicator. It called my attention when I was reading openlitespeed web server documentation where they states that the Duplicator plugin is the plugin to go.

Here is the article: Methods for Migrating WordPress

Old school moving a WordPress site to a new host

Moving a web site the old school method is moving it manually. In short it means copying content by ftp, make a new database and import the SQL export you made earlier. When a database is to big and the server times out I use a script to import large databases called Bigdump.

Manually migrate a WordPress site

  1. Export your database using PHPmyAdmin
  2. Download your content via ftp
  3. Make a new database with user and password on the new host
  4. import the database, for large databases you can use a script called Bigdump
  5. Upload your content to the server root directory
  6. Change database settings in wp-config.php

Moving a WordPress site to a new domain

When you move your WordPress site to a new domain all steps are the same, we can use a SQL command to do this or use a plugin called better search replace. What you do is changing the website url to the new web site url and all links.

We recommend using the query first and then Better search and replace to change the urls for plugins and to control if all urls are renamed.

Remark: your database tables might have a prefix and the default query will not work, replace wp_ for your prefix_ or use a tool like : SQL Queries to Change WordPress Website Domain

A query via phpMyadmin would look like this:

UPDATE wp_options SET option_value = REPLACE(option_value, 'https://old-domain.com', 'https://new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = REPLACE (post_content, 'https://old-domain.com', 'https://new-domain.com');
UPDATE wp_posts SET post_excerpt = REPLACE (post_excerpt, 'https://old-domain.com', 'https://new-domain.com');
UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, 'https://old-domain.com','https://new-domain.com');
UPDATE wp_termmeta SET meta_value = REPLACE (meta_value, 'https://old-domain.com','https://new-domain.com');
UPDATE wp_comments SET comment_content = REPLACE (comment_content, 'https://old-domain.com', 'https://new-domain.com');
UPDATE wp_comments SET comment_author_url = REPLACE (comment_author_url, 'https://old-domain.com','https://new-domain.com');
UPDATE wp_posts SET guid = REPLACE (guid, 'https://old-domain.com', 'https://new-domain.com') WHERE post_type = 'attachment';

Use those tools:

The Duplicator plugin

I think the Duplicator plugin does it old school and is a plugin that is made for moving a WordPress site and can be used as a backup tool. I also like the plugin Updraftplus that is a plugin to make backups and can be used to move sites also.

The Duplicator plugin makes a zip file of your content and a installer file. You can download these and upload it via ftp to your new host. Visit the installer file and start installing your site on the new server.

I like the method because it does it old school but a lot easier. If you run into memory or upload limits of SQL files you can always use bigdump to import the database as the content can or is unzipped on your new server.

How to use the Duplicator plugin to move a site

  1. Install and activate the Duplicator plugin on the WordPress site you’re copying from.
  2. Navigate to Duplicator > Packages, then click the Create New button.
  3. Go through the wizard. When you see “Package Completed,” click the One-Click Download link to download two files.
  4. Move the two files (installer.php and a zip file) into the folder you’ll want the WordPress site in.
  5. Visit installer.php in a web browser and you should see a wizard screen.
  6. Click I have read and accept all terms & notices and Next
  7. You’ll need to have a database ready. Enter the database name, user, and password.
  8. Click the Site Login button and log in to your WordPress site using the same username and password as you have on the remote site.

Moving a WordPress website to another server or host

Let’s start (testing) and move a website with the Duplicator plugin. We start facilitating a new hosting account and database.

In my case there is an existing install of the old website and I am going to leave it as it is and see if I can install the new site over the old one. The only thing I think I should do afterwards is removing all old tables what I can recognize at its prefix eg: xxxx_wp_users.

I made sure I have the username and password of the database I can retrieve from the old wp-config.php file. Normally you would take a note when you make the database and user.

Let’s migrate a WordPress site

  • Install the duplicator plugin on the website you want to move.
  • Activate it and go to settings.
  • Make sure you deactivated plugins you think are not compatible, I deactivated LSCache and my firewall.
  • Step 1: Make a backup by pressing create new.
  • Step2: Keep the default settings and name and click next
  • Step3: Agree and click build
  • Download your files by clicking on One-Click Download.

Install your new site

By the time you are reading this I just migrated the website and picked up this article I was writing.

  • Step 1: Go visit http://yourdomain.com/installer.php
  • Agree and click next

I walked in to a problem having a wordpress website already installed, so I had to remove it.

  • Step 2: enter your database name, user and password and click next.
  • Step 3: (I had a website already on SSL so I changed http to https) keep the defaults and click next.
  • Step 4: Test your website and login to your admin dashboard.

See also: https://youtu.be/oc73jtvHWYQ

Conclusion

One word: wow. So fast so clean no problems, everything is working fine just how I left the site I see and use the new site.

The real website is still running as the DNS is still pointing to that server, in order to finish I must change the records that points to the old server ip address to the new servers ip address.

I edited my local hosts file to access the new web server and testing it before I modify the DNS records.

Remarks: I saw that after migration the database was clean, all old tables were removed. SSL/HTTPS was still working.

I needed to safely remove incompatible plugins, in my case that was LSCache, I am gonna miss you.

I needed to manually remove the duplicator (generated) files and folders.

The duplicator plugin is not bad, you should remove any duplicator (generated) files after finishing. I would definitely use it again and recommend it to others including my clients. I managed to migrate a website in matter of minutes with zero downtime. The only downside is that if you want to add a database table prefix you need the pro version.

When you tested your website and everything is working fine and accepted it as it is, you can now finish by pointing your dns records to your new ip address of the server.