We have seen many online requests on how to move a WordPress blog to a new server or host-including requests from some of our clients.
It seems that the easy part should be to transfer files. What most people find it difficult to move their WordPress database to the new server or hosting company?
It may seem like difficult at first with all the steps that we understood, but we assure you it yourself is easier than looks- especially after you move a blog a few times. It may seem like there are many steps to migrate WordPress blog to a new server, but there is really not much.
Keeping all this in mind, we can imagine that many people have the same problem, or have no idea where to start, so here you will find instructions on how to perform this operation without losing theme elements or end up with a complete site for broken links.
Keep the same URL
First, it is important to note that if you have not really optimized the site and intent on keeping all the URLs, and the domain name and the database will stay the same then it is a simple process.
If that is the case, then you will just have to copy the files and database on the new server. If you want to change the name or user of the database, you have to change the edit.wp-config.php file to make sure it has the correct values. Locate the following in the root folder and modify accordingly.
/** MySQL database username */
/** MySQL database password */
If you decide to change server, by keeping your domain name, then you need to change wp-config with your new databases and user then simply upload all your files to the new server.
It’s appealing obvious too, but bears repeating, you should do a full backup of the site, which should include the following:
- Theme files
- All additions you have made
- The database
To do this, you can use phpMyAdmin, a MySQL database management tool for open source and includes a multitude of useful tools. You can choose to export data in a number of formats, such as CSV, SQL, XML, PDF, ISO / IEC 26300 and others. Alternatively, you can use a plugin like WP-DB-Backup.
Local download a remote installation
Once you are fully backed up and ready to go, first of all you will need to disable Permalinks. This can be done in the “Permalinks” screen display is in the “Settings” menu. Choose the default setting, and click save.
WordPress installation on the new server
Install WordPress as you normally would, either via FTP or cPanel then copy all files from your local file wp-content than on the server via FTP or SFTP. Then you need to change the database to replace the local URL with one remote.
For this, use a search and replace utility, preferably not a text editor and replace each instance of the local URL to one remote. You can use Search Replace DB for what should be installed in the root folder of your WP install for best results. To protect the script of abuse, it is better to rename it before doing anything else.
For example, if you rename newinstall.php, you will then go to http://yoursite.com/newinstall.php and follow the instructions on the screen to search and replace. Once you have finished doing so, it is important that you also remove the script to ensure the DB.
Save the database before continuing. If a new database was created when you installed WP, then it should be removed. You can do this by:
- Using phpMyAdmin, click the “Structure” tab
- Below the list of tables click on “Check All”
- Choose “Drop” from the menu called “with selected”
- Choose “Yes” when the message appears asking if you want to remove all tables
- Reactivate your permalinks as you had in the last installation
Moving a host
If you move the site to a new host, it is exactly the same as when you download from a local server with an essential difference being that you need to download all your files from the existing host using protocol FTP.
Changing the URL
If you need to change the URL of the site as a subdirectory or it is a new domain name, you can do so by adding lines in the functions.php file of the theme, as before below.
Then upload new files to the site and it should work fine. Do not try to simply copy all files and database is complete, it will not work correctly and you’ll end up with broken links.
Once you have loaded the then new files, test and remove lines of functions.php files, that your new settings will now be stored and saved in the database.
If you need to set up 301 redirects, which are important for both search engines and users, then you will need to connect to the old site and edit the .htaccess file. Locate the file and then paste this code at the top of the file:
1 #Options +FollowSymLinks
2 RewriteEngine on
3 RewriteRule ^(.*)$ http://yoursite.com $1 [R=301,L]
Once you’ve done that, come back to the new site and test to ensure that the changes were made successfully. It is also a good idea to submit the change to the URL to Google via Webmaster Tools and you will also need to check.
Finally, once you are sure everything is working and that you have checked and tested, remember to tell site users on change. You can do this regardless of the way you think is the most effective, by newsletter, blog post or social media and if you still have the old domain, you can configure a temporary redirect to catch any falling d first through the net.
That’s it, all you need to do to change the location of your WP site, even if you use a new URL.