Easy WordPress website migration without plugins

Website migration – step-by-step easy WordPress migration

There are lots of migration plugins and tools. Some are good – some are a disaster. I tried several of them, and to be honest, they only caused me stress. The result was somewhere between poor and mediocre, and one day I asked myself why I was still working with them, when manually migrating a website is easier and faster.

Migrating to another domain name is, strangely enough, easier with a plugin than a migration where the domain remains the same. The latter, however, occurs much more frequently: a migration from one hosting to another where the website itself remains unchanged.

Migrate a website where the domain remains the same?

  • Follow this simple step-by-step explanation and you’ll be done in no time!

You want to migrate a website with a domain change?

Step-by-step migration of a WordPress website

Precautions

  • For migration to a new hosting but with the same domain.
  • Don’t forget about the email and subdomains of the site you are migrating.
  • Don’t remove your old site before the DNS to your new site is at least active for 24 hours and all works well.
  • Before you start: read the tips at the bottom.

Step 1: Create a new WordPress install on the new host

  • Add the same domain name to the new hosting in DirectAdmin / Domains.
  • Don’t move the domain itself yet – or not at all.
  • Create a fresh WordPress install.
  • Make sure the WordPress version is the same as the old website or newer, not older. 

Step 2: Backup your database (active existing website)

  • You need access to DirectAdmin / phpmyadmin. 
  • In DirectAdmin you select Manage and Export
  • In phpMyAdmin, select the database on the left (not just a table) and click “Export > Go”

There are several ways to find the database details. Personally I prefer the first one because it’s easy to find and you can paste the same data in the new wp-config.php file.

1) wp-config.php

  • Open Directadmin
  • Go to System info & Files / File manager
  • Open the correct folder (with the name of the website)
  • Open the folder ‘public_html’
  • Open (Editing mode) the wp-config.php file
  • Copy the Database settings
  • Copy the $table_prefix

2) Domain settings

  • Open Directadmin
  • Select the correct domain
  • Dashboard:
    • Additional programs
    • WordPress Manager
    • Expand using the arrow (on the right)
  • Click on (+) Database details
  • Note the name of the database
  • ‘View database’ takes you directly to the database

3) PHPMyAdmin

  • Click on the ‘PHPMyAdmin
  • Click on the database

4) Plugin WP-Optimize

  • You can also use the WP-Optimize plugin.

Extra information (optional)

  • The “quick” option is usually good enough but if you’re using the same database for multiple projects, you can always select “custom” and pick only the tables you want.
  • It’ll download a SQL file that contains all your data! (It’s a good idea to create backups every week)
  • If for some reason you’d prefer using a plugin, UpdraftPlus mentioned above is actually pretty decent to do that.

Step 3: Prepare the new wp-config.php files

  • Note: This is done on the old website, and you require details from the new website. 
  • You require access to your files, through FTP or a file manager (on DirectAdmin or a local harddrive).
  • The wp-config.php file, located at the root, is essential because it contains the access information to your database.
  • It’s best to leave your original file as it is, so you still have access to your old website.
  • Duplicate the wp-config.php file and give it a name like wp-config-new.php and open it in an editor.

Those are the lines you need to edit:

/** The name of the database for WordPress */
define( 'DB_NAME', 'new database_name_here' );
 
/** Database username */
define( 'DB_USER', 'new username_here' );
 
/** Database password */
define( 'DB_PASSWORD', 'new password_here' );
 
/** Database hostname */
define( 'DB_HOST', 'localhost' );
  • Note: Replace the old values with the values from the new database. 
  • Make sure the table prefix is correct; you are importing tables from the old database, so you should use the prefix from the old database as well in the new wp-config.php file.
  • It usually looks something like this:
$table_prefix = 'wp_';

If you have a reason to change the prefix (be careful), this is how:  wpmarmite on how to change the prefix.

Step 4: Backup the data (old website)

Already done:

  • Created a fresh install for your website.
  • Prepared the new wp-config.php file.
  • You have all the database login information. 

Get the data:

  • You need to compress the whole content of the WordPress directory in a .tar.gz format.

If hosted locally: 

  • You need a zip app. Those are freely available.
  • Select everything, right-click, add to archive, and create a tar file.
  • Right click again, compress, and gzip.
  • Now you have a file named ‘{something}.tar.gz’

If hosted on a server:

  • You can do something similar with whatever file explorer your host offers, through DirectAdmin or another interface.

Tip if you don’t know what data to save:

  • The folder public_html is most important and enough for most WordPress migrations.

Step 5: Upload your data to the new website

  • Add the file to your new host in the directory where you want your WordPress to be installed and extract your file.
  • The easiest way to do this is also with the file explorer your host offers, through DirectAdmin or another interface.
  • Upload the file to the domain folder.
  • Remove the old folder public_html.
  • Double-click on the zip file you just uploaded.
  • The file extracts and you should see the new public_html folder with some folders in it.

Step 6: Import your database into the new hosting

  • The data is already uploaded and extracted.
  • Now it’s time for the database. 
  • You need access to the DirectAdmin and phpMyAdmin of your new host.
  • Note: In most cases you don’t need to go in phpMyAdmin.
  • Go to DirectAdmin; databases.
  • Find the correct database and click on ‘Manage’.
  • At the bottom click on ‘Import’ and select the right file (.gz or .sql are both usable).
  • Wait until the import is ready.

Step 7: Change the wp-config.php

  • Go to public_html or the root of your newly installed WordPress directory, rename your ‘wp-config.php’ to ‘wp-config-old.php’ and rename ‘wp-config-new.php’ to just ‘wp-config.php’.

Step 8: If you changed the domainname (optional)

  • This is optional and only if you migrated to a new domainname.
  • If your hostname changed (e.g. local to online or a new domain) you need to go to phpMyAdmin, open your database and change the value of ‘siteurl’ and ‘home’ in your {prefix}_options table.

Step 9: Final step: DNS

  • This manual is about migrating a site with the same domain.
  • That implies that the DNS records have to be changed now to direct the visitors to the new hosting with the newly installed website. 
  • Go to the provider where your domain is hosted.
  • Open the DNS of that domain.
  • Replace the IP address of the A records with the new IP address (the same type).
  • Replace the IP address of the AAAA records with the new IP address (the same type).
  • Usually those records are also present for www; just repeat these steps. 

Check the DNS (optional)

Step 10: Create the new SSL certificate

  • Essential: Your DNS needs to point at the new hosting before you can create the new certificate. 
  • Don’t forget: it can take several hours for some servers to know your new DNS. Until then visitors are still seeing your old website.

Afterword about Domain and Email

  • You might also want to move the domain itself to the new hosting. Always make a copy of the DNS settings first (Strangely enough, most providers still do not have an export tool for that).

Tip about email

  • It is most convenient to host your email separately from your website. For example, at mxroute.com.
  • If you move the domain; please remember the subdomains.
  • Make sure you don’t forget your email. You can leave it at the old hosting, but in most cases you want to move that too.
  • Always play safe; make backups en don’t be too hasty with deleting old data.
  • Sometimes you wonder: is the domain showing the old or the new site? This is important to know before you decide to delete the old site or cancel the hosting. There are two ways to know for sure:
    • Make a minor change to your old website right after exporting the data, like modify the design, edit some text, or add a new plugin.
    • Use a Chrome extension like ‘Website IP’; it shows the IP of the website you are visiting.
  • It might be a good idea to set the domain (in DirectAdmin) to Force redirect > https://yourdomain.com, and activate SSL to ‘Force SSL with https redirect’.

Similar Posts