Monday 3 February 2014

Tagged under:

How to Move a WordPress Site from One Server to Another Host

Over last couple of months, I am wandering here and there for finding a stable hosting provider. After moving my WordPress blog between several hosts, today I thought that my experience might help you in moving a WordPress site to new server as I faced some difficulties in beginning when I wasn’t familiar about how to make this move. So this tutorial will help you if you don’t know how to move your WordPress site to a new hosting provider’s servers by retaining its originality.
Though several hosting providers offer their free migration services and they move your site to their servers when you purchase a hosting plan there. Still it isn’t a good choice as you need to complete several request forms or you need to send a request email to their support for this purpose. It takes time and I don’t like or recommend it all. In addition, a lot of paid migration services are also there but they cost you money. So it is necessary to learn about basic skills like moving your WordPress blog to a new host. Learning and practicing the procedure is a fun as well as it will save you some money too along with time and frustrating delays :)
Let’s talk about the procedure for switching between hosting providers. This tutorial is for cPanel users on Linux servers. Though you can use the easier “Complete Backup” option of cPanel to clone a site to a new server, but it migrates all the content and there might be several directories on your server which contain the garbage. So moving only needed content will save you some storage space as well as time. For this purpose, I’m guiding you through a manual process which will clone your WordPress blog to a new server within a few minutes.

Moving WordPress Blog to a New Server

First Step: In first step, you will obviously purchase a new hosting package. After purchasing the hosting, log in to your cPanel on new server and confirm that the hosting provider has activated your account and you can access it.
Second Step: Now log in to cPanel on your old hosting account and then navigate to the root directory of your domain in “File Manager” which is public_html in most cases. There, you will find several directories including wp-admin, wp-content and several others. Select all directories which belong to your blog.
cpanel-filemanager
After selecting the files and folders, you need to deselect a file and a directory which are .htaccess file and cgi-bin directory. To deselect these, press and hold Ctrl key and click the file and directory individually.
backup-files-cpanel
Step 3: After selecting files and directories in your domain’s root folder, compress them to a new zipped file. Name the zip file as backup.zip, select zip as format and press “Compress File(s)” button.
compress-files-wordpress
Step 4: Once the compressing process completes, a new compressed file (backup.zip if you have renamed it) will be created in your domain’s root directory. You can download the backup.zip (may be with any other name if you haven’t renamed it) file from your website at http://.yoursiteurl/backup.zip. Download the zipped file and store it on your computer.
Step 5: Now you need to download the backup of your blog’s database as WordPress stores all posts, comments, other text based content and all themes and plugins configuration details in a MySQL database. To download the backup of your database, go to phpMyAdmin. (You can download your database’s backup using cPanel’s backup feature but it sometimes creates bugs during restoration process later on new server)
phpmyadmin-section
Step 6: In phpMyAdmin, download a backup of your database. First select your blog’s database from the list on left side panel and then use “Export” feature to download the database backup. Simply download an SQL backup file for your database by pressing “Go” button and don’t configure any compression features to avoid bugs later in restoring the backup on new server.
database-backup
Step 7: After downloading the backup of your domain’s root directory and blog’s database, now its time to upload the content to your new server. For that purpose, log in to your cPanel on new server and again go to its file manager (domain root directory which is public_html by default). Enable the option for showing hidden files while accessing file manager.
In your domain’s root directory, upload the backup.zip file which you have downloaded earlier. After uploading the file, decompress its content. All stuff will be extracted to the root directory on new server. To decompress the file, select it and press “Extract” button on tools panel
upload-content
Step 8: Now you need to edit the .htaccess file on new server. .htaccess file should be visible in root directory of the domain if you have enabled the display of hidden files. If you haven’t enabled this, go back to cPanel and now open “Legacy File Manager” for your domain’s root directory. There, click .htaccess file in Legacy File Manager and on right top, you will find the edit option for the file.
legacy-file-manager-cpanel
Edit .htaccess file. An editor window will open. Now open cPanel on your old server and edit the .htacess file there with similar method as I mentioned above. Copy all content from old .htaccess file and then replace the content in .htaccess file on new server by pasting the copied content in it. After pasting the content, save the changes and close the editor.
Step 9: You have almost finalized the task. Next, you need to create a MySQL database and then import the database backup which you have downloaded from the old server. To create a new database, go to “MySQL Databases” from cPanel and then create a new database. Name it wpblog or something else according to your choice.
mysql-database
After creating the database, create a user by setting a strong password for it and then add the user to newly created database. To add the user to new database, scroll down the page, you will find the option to add the user to your created database. During adding the user to database, assign all privileges for it.
Remember the username, password and database name accurately. You need to remember the username along with prefix which is something like cpaneluser_. The complete username will be cpaneluser_username and database name will be cpaneluser_wpblog . The values will vary according to your cPanel username and the names you choose for your database and for the user.
add-user
Now you need to import the database content from downloaded backup into newly created database. To do so, go to phpMyAdmin again as you did earlier on old server to download the backup of your database. If you have forgotten the process, look above in initial steps for screenshots. In phpMyAdmin, select the recently created database from left sidebar and now go to “Import” tab. In “Import” section, select the earlier downloaded backup file (.sql) by pressing “Choose File” button and then press “Go” button to restore the database content.
Wait till the upload completes. Once the upload is completed, it will restore your all posts, pages, comments and the personalized settings for themes and plugins.
After the upload is complete, go to File Manager again and now edit wp-config.php file. Find the database name, username and password in wp-config.php file and replace the values with newer ones which you have remembered during creating the database and user on new server. After making the changes, save wp-config.php.
Now you have successfully cloned your WordPress blog to a new server on a new hosting provider. Finally, you just need to redirect your domain to the new server by modifying its DNS values from domain’s control panel. Once the DNS is modified and it propagates, visit your URL to view your site. The site will be accessed from the new server with the similar look, content and configurations as it was on the previous server.
You might be thinking that I made this tutorial lengthy, but it is the best way for non-techies to clone a WordPress blog to a new server without facing issues. There are several shortcuts but they bring failure in most cases and you will get frustrated a lot. So this tutorial should help you in comfortably and successfully moving your WordPress site to a new hosting provider. If you are still facing any bugs, let me know in comments or by contacting me via contact form.

0 comments:

Post a Comment