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.
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:
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;
- 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.
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;
- 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.
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.: 188.8.131.52 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
|500 Internal Error||
|Database connection cannot be established||
|Site’s redirecting to installation||
|File is not found with the path like /home/user/...||
|404 error and/or default/blank page||
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!