D5 Creation Blog

WordPress Migration

Complete Guide for Moving WordPress Sites to a new Location

All it takes to create a website on WordPress is a unique domain name and hosting. Having taken into account your future site’s name simplicity, limitless of bandwidth and space of a hosting company you choose, you are on a hot stick. However, more often than not site owners come up with a necessity to move their sites to a new location.

There are numerous moving paths you can take full advantage of. But what can the word ‘location’ stand for?

  • hosting to hosting;
  • a domain to a new domain;
  • a subdomain to a main domain;
  • a subfolder to a new folder;
  • a localhost to a live host.

Although you may say too different aspects are to be evolved for following one and the same instruction while moving a website, you are vastly mistaken, as long as despite what you change the same steps will have to be taken. The only difference is whether you solely change a domain direction of your website or move it to another hosting server’s physical space, etc.

 For D5 Creation Theme Users: You should also Read This Article for Theme Options/Settings.

 

A Pain-Free All-Purpose Migration Plan

First of all, you need to check if both of your hosting providers run the same control panel versions (cPanel-cPanel, Plesk-Plesk, VestaCP-VestaCP, etc.). In this case you are highly advised to work with a built-in import/export procedure. For this purpose you should contact a new hosting provider, so that it can assist you in the issue, as this usually requires a higher level of privileges average customers are deprived of.

Then you should judge from the aim you pursue whether you are going to move the site between different control panel(s)/server(s) or to study up on the fundamental migration components. While being intended for the latest purpose we should clarify your view of things and state the migration process consists of 3 major steps in general: backup, restore and verification.

So, read yourself into the steps while holding your hands on the keyboard:

#1 BACKUP

A . Find out and write down the current path to your WP install. It may be usually found in your control and/or ‘welcome’ email you got when received the hosting. It may be required if you have custom plug-ins like WAF installed and the path hardcoded in .htaccess and/or wp-config.php

B. Write down the current site’s IP address, the ongoing domain name and registrar (where DNS records are located). The easiest way to make it is to use online services to get all your domain records placed on a single page.

C. Providing that you are on stock MySQL database, the backup process will acquire the form a crucial part of which is all your valuable data kept inside. It may be backed up via different means:

  • a control panel backup;
  • WP backup plug-ins;
  • phpMyAdmin;
  • SSH console and MySQLdump command.

The most appropriate method is a control panel backup, as it’s almost completely free of errors.

D. Files backup: WP itself is a set of files and few configs (.htaccess, wp-config.php, wp-settings.php, etc.). It may be backed up via similar methods:

  • a control panel backup;
  • WP backup plug-ins;
  • FTP/SFTP/SSH access.

As well as for the previous step, a control-panel-backup way is the best. However, FTP/SFTP method is also widespread.

Now, with the database and files on hand you are ready to move the site physically.

 

#2 RESTORE

A. To start with, you should get all the access details from a new hosting provider:

  • a new login/password;
  • its control panel URL;
  • the way to access the database (in case there is no control panel);
  • the path to the document (web) root of the site.

B. Import the database: depending on a provider, you are either provided with predefined MySQL login details (host, database, username and password) or presupposed to create them via the control panel. The import itself may be completed via

  • the control panel;
  • phpMyAdmin;
  • SSH console with MySQL command.

C. Then you need to restore/upload your files. One of the most effortless methods is to upload the files via FTP/SFTP or SSH (scp/rsync) to the web/public_html directory on the new hosting server.

D. Once everything is done, you should fulfill some essential modifications. As long as the site is moved to a new place, you will have to edit a few more files, they are:

  • .htaccess (check if there are any paths like /home/user/...). You need to replace it with the path to the document root (section #2 RESTORE/a);

 

  • wp-config.php & wp-settings.php (check the same path and also your database settings: the host, the database, the username and the password). Here you should replace the current path with the path to the document root (section #2 RESTORE/a and the database settings with ones you have in section #2 RESTORE/b).

!!! Take note that in case you change the domain name to a different one you need to login to your database (phpMyAdmin is the most convenient way), browse the database to find the table wp_options and search for the old domain name to replace it with a new one. The common option_name characteristics are: siteurl and home.

E. DNS records’ restore is required only in case you are moving the domain name. Although it is out of the scope of the guide, you may need to change the nameserver for a new hosting provider. In one word, if you manage a DNS zone yourself, the main (and www if it is not a "CNAME" type) "A" records for the domain should be updated to a new IP address.

!!! When changing the DNS zone and/or updating the records you will need to wait from 10-60 minutes (records update) up to 72 hours (nameserver update) for changes to be off effect. It is important to realize that the step should be taken after the verification is done, though you can accomplish them simultaneously.

 

#3 VERIFICATION

A. Having made changes in section #2 RESTORE/e, all it takes is to open the site. Keep in mind the fact that the process can take up some time (section #2 RESTORE/e).

B. The right way is to become a developer, as long as the step requires more advanced knowledge in your OS. The basic thing you need to do is to change the IP address for the domain name (and its www where available) for a new IP address. This can be done in two major ways:

  • in your router static DNS settings (it is rarely available for edit!);
  • by editing file called /etc/hosts. The file’s location depends on the OS. However, the most common paths are: Linux/OS X (Mac): /etc/hosts; Windows: C:\Windows\System32\Drivers\etc\hosts.

You need to have administrator (root) rights to edit the file. The format is very simple, a single line with IP address and all domain names/aliases.

E.g.: 1.2.3.4 domain.com www.domain .com. You can also back to the step when the verification is confirmed.

C. Having met with adversities, you need to run plan B:

 

Up to Rip Your Hair Out? Use Plan B

 

WORN-OUT PROBLEMS
500 Internal Error
  • The trouble is one of the commonest issues one may come up with while migrating a website. If that’ the case, you are highly recommended to check the error logs in the control panel, as they can provide you with the further details. The error may also be caused by wrong entries in .htaccess file.
Database connection cannot be established
  • The difficulty has two scenarios: either this means you have wrong database connection details in your wp-config.php and/or your database/access not yet created. All it takes is nothing more than creating/fixing (hint: file wp-config.php).
Site’s redirecting to installation
  •  The error means you have forgotten to import the database and/or provided the database connection details to an empty/wrong database. So, check the settings in wp-config.php and via phpMyAdmin if it exists.
File is not found with the path like /home/user/...
  • The odds are that you have included the file(s) using the old path. You should verify your .htaccess, wp-config.php and wp-settings.php
404 error and/or default/blank page
  • In this case you might have forgotten to upload the site to the proper document (web) root. Most (if not all) providers have either www or public_html directory where you need to upload the site.

 

When moving beyond you may have a rough passage with files, plug-ins and themes transferring. Remember that in case you are not interested in a new theme assignment, you shouldn’t ignore all the wp-content/themes stuff copying. While having some problems with plug-ins, you need to make sure you have transferred all the wp-content/plugin content, as well as imported the SQL file correctly. For you not to lose all the media files you have, make sure you have no memory errors, as in this case the wp-content/upload copying process should be restarted from the very beginning.

As you remember, while transferring heavy data you may come across with speed losses, which can result into timeout errors. This can be won through by speeding up the process in bulk. For this purpose you need to bear in mind such showings as:

 

  • a good internet connection (no limitations on bandwidth or speed);
  • a compressed archive can be made (.zip, .rar, etc); !!! The functionality is not permitted by some hosting providers or you can be not supplied with SSH access to the server.
  • FTP/SFTP should be substituted by LFTP and mirror commands then;
  • Having SSH access to both servers you can transfer the content directly avoiding the intermediate local saving. !!! When this occurs you risk losing all the content irreparably.

 

Moreover, some problems concerning file permissions can also appear if security measures of your new/previous hosting server diverge. Thus some hosts allowing full access to the files contradict the hosts caring about security. This can result into ‘internal server error’ page. However, being provided with SSH access to the servers you have a possibility to use the following command (chmod –R 644 /path/to/folder/) to change the files permissions.  The adjustments can also be fulfilled through the Administration Panel of the new hosting if you are allowed for. All the site’s after-migration configuration problems can be solved by telling the WordPress its location has been changed.

 

The WP Site’s Migration Final Outcome

That is not to say that you have to be a website developer for migrating a WordPress site to a new location, but that any interested reader can make everything without recourse to expert’s help. Having pursued the lead, by this very moment you might have successfully moved your WP site to a new location! It shouldn't be too hard if you follow the guide. However, if you feel more confident when the IT tasks are done by professionals, hire someone to perform the migration task and you will still be able to understand the whole process. Work up the nerve and you will take a special satisfaction in achieving the objectives!

 




Author : Yana Vardomatskaya

Yana Vardomatskaya is a VP of Business Development for HQSoftware, a custom software development company with offices in New York City, Tallinn and development center in Minsk, Belarus. Having started with a wide variety of custom software development projects, now the company has made a go of IoT and AR/VR. The company’s 16Y hard-won experience in business has resulted in high performance of projects carrying-out on time with an immense amount of satisfied customers

Comments are Closed