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 zip or .tar.gz format. Don’t panic, in 99,9% of cases that’s what we call a normal zip file.
If hosted on a server:
  • You can do something similar with whatever file explorer your host offers, through DirectAdmin or another interface.
  • Go to DirectAdmin, File Manager, Go to domains, find the folder with the name of the website, rightclick on the public_html folder and select Archive. It creates a zip file within 3-15 minutes, ready for download.
If hosted locally: 
  • You need a zip app. Those are freely available and on macOS it’s native functionality.
  • Select everything, right-click, add to archive (or just ‘archive’), and create a zip file.
  • Right click again, compress, and gzip.
  • Now you have a file named ‘{something}.zip’ or ‘{something}.tar.gz’.
Tip if you don’t know what data to save:
  • The folder public_html is the root directory of your site and contains the necessary data 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’.
  • If you forgot this step, it won’t work.

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

  • The DNS needs to be updated so that the IP addresses point to the new hosting.
  • There are different procedures:
    • The domain remains with the existing domain hosting provider; in this case, you only have to update the IP addresses.
    • You move the domain also to the new hosting provider: in that case you have to adjust more; see below.
    • Essential: If the old hosting is hosting your email also, you have to take precautions to save the existing emails in your mailbox before you change DNS.

The domain remains with the existing domain hosting

  • This explanation assumes that you keep the domain with the original domain host (i.e., you do not transfer it) and you didn’t change the domainname.
  • 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. 

The domain moves to the new hosting

  • First adjust the DNS records as if you were not moving the domain (former step). This ensures your domain is moving home address without missing visitors…
  • Wait at least 1 hour (preferably 4) after that step to ensure the DNS points to the new website.
  • Go to the provider where your domain is hosted.
  • Copy all the values (name, kind or record like CNAME, TXT, and the value) and save them in a note.
  • Ask for the migration (EPP) code. This is sent by email or shown on the screen, depending on the extension.
  • Register the domain with your new hosting and use the migration code when asked.
  • The migration itself takes between a few seconds to several hours.
  • When the domain is active (migration successful), connect the domain to your hosting. The interface for connecting depends on your hosting, but every hosting has it.
  • In DirectAdmin, CPanel or whatever you use, go to DNS.
  • Create the same records and values as in the old DNS records, except for the IP records A and AAAA.; just enter the IP addresses of your new hosting.
  • If you use your new provider for email also, you need to change those records so they match the new provider’s email details.

If the new provider is hosting your email also

  • Was your old provider hosting your email as well? Save important emails before you change the DNS records.
    • There are professional email migration tools, but the easiest is moving them temporarily to another email account. After creating your new email account you can move them back. All done with a good email client (app). Even Outlook or Apple Mail can do that.
Don’t forget those DNS records:
  • Don’t forget to add the DKIM record(s) of your SMTP provider if you use one.
  • Include an external SMTP in your SPF record.
  • Some hosting companies don’t create a DMARC record. I advise you to create one.
  • If you have authenticated your site for Google with a DNS record, create an identical record now.
  • If you use an external email host (like mxroute.com), you have to change the MX records, mail record and re-create some authentication records.

Check the DNS (optional)

  • If you want to check the domain > IP correction.
  • Don’t forget the DNS records for the www version as well.
  • You might want to add a redirect (301) from: https://www.yourdomain.com version to: https://yourdomain.com (better for SEO and for the visitor).
Check the DNS change

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.
  • If you added your first mailbox after creating the certificate, you have to re-create the certificate including mail.

Aftercare

  • You have not only moved a website but also all settings. This includes files such as wp-config.php and plugin settings. In particular, pro plugins that are updated via the publisher rather than via WordPress.org can sometimes give error messages during updates and backups.
If this is the case
  • Check the wp-config.php file.
  • Deactivate the relevant plugins and reactivate them using the license key.
    Usually, everything returns to normal after this.
  • If the issue persists, upload ‘fresh’ WordPress core files: wp-admin and wp-includes folders to your server, overwriting the old files. Never overwrite wp-content or wp-config.php.

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