How to Transfer WordPress from one server to another

hp_mediasmart_serverUsually developers develop the website on their localhost or temporary server and then move it to the live server. This makes development easy as the files on the locaserver are very easily accessible and editable and you don’t need internet connection working all the time.

Other than that, there many instances when some one wants to move wordpress installation as:

  • from one directory to other in the same server/domain. Like from www.website.com to www.website.com/blog or blog.website.com
  • from www.website.com to new domain say www.domain.com

Or any other case. This tutorial explains how to transfer you wordpress successfully and also setup it properly on new server.

The main steps required are:

  1. Copying files
  2. Copying database
  3. Editing WP-Config.php
  4. Editing in database
  5. Misc

1. Copying files

In this tutorial, we will be moving files from my windows seven running localhost (xampp) system to my cpanel11 based webhosting.

So first step is to make sure that you have done all the tasks that needed to be done on localserver, and your website is ready to be moved on to the live server

Goto you xampp/htdocs directory and select your wordpress installation folder, and zip all the files. You can either zip the folder, or go inside the folder and zip the files in it. I will prefer zipping the files inside the folder directly, we will see later why. Please note, that if you are running winrar on your computer, don’t use the rar format to compress the files, instead zip them.

Once zipped, we are ready to transfer them to the server.

(Please note, you can also use only ftp to upload the files to your server, if you need help with it, please leave a comment below and i will add info about it to the tutorial.)

Login to your cpanel11 hosting server by your-domain-name.com/cpanel or your-domain-name.com:2082 and entering username and password assigned by your hosting provider company.

Goto filemanager (i don’t use legacy file manager, use the simple file manager)

in the folder where you want your wordpress files to be, simply click on upload button in the file manager and upload the zipped file.

Once uploaded, simply unzip the files, as we are already in the current directory.

So once the files are uploaded, we are ready to go for the database part.

2. Copying database

Once the files has been transferred to the server, now we will copy the database from our localhost to the server.

For this purpose, goto localhost/phpmyadmin (If you are copying from one live server to another, simply goto your control panel and launch phpmyadmin from there)

(Note: if you don’t know how to or don’t have access to phpmyadmin, let me know, there is work around for it.)

In phpmyadmin, select your database name.

Once in the database, with its tables list being showed, click on export link in the top menu.

This will take you to the database export page. There is usually no need to make any changes to it, simply scroll down the page, and in the last option, which asks you to “save as file” select this option by checking the check box and click Go. This will save the database as file for you. Please note the location of the database file when it downloads.

Once it is downloaded, goto your webhosting server and goto phpmyadmin. Please note you have to create a new mysql database and add user with permissions to it before going to phpmyadmin. (Let me know if you need help regarding this in the comments)

Once in the phpmyadmin on the new server, select the new database name from the database list. Once the database page loads, simply click import from the top menu and then browse the file that we just created by the previous server phpmyadmin and click Go.

This will add the data from that database file to this new database. Please note, the database or username don’t need to be same. It can be anything and will work without any issues. You don’t have to make any changes in the database file to transfer it.

Once the files and database has been transferred successfully to the new server. We will now setup the config.php and the database.

3. Editing WP-Config.php

Goto file manager and to the directory where your wordpress files are present. Select wp-config.php and click on edit to edit it.

In the edit window, change:

  • DB_NAME to the new database name
  • DB_USER  to the new database user that you assigned while creating the new database
  • DB_PASSWORD to the database user password.
  • DB_HOST is usually localhost, but if your hosting provider have different database host, like some path or ip then enter that here instead of localhost.

4. Editing in Database

The common issue seen in wordpress database transfer is that people forget to edit the database settings, which leads to issue like when they open the new-site.com it gets redirected to old-site.com

This is simply due to the settings inside the database and can be edited easily.

Simply goto the same phpmyadmin page and select your current database. From the tables list, select wp_options

It will display the list of fields in this table. Click on browse from the top menu here. We will change 2 enteries here. One for site_url and other for home

Click the edit icon (pencil) with the site_url (second entry in the list) entry and inside edit window, change the url to your new url

Goto next page, to the 39 entry home, and do the same with it and changing the link to your new site url.

This we we have made the basic change to database.

5. Misc

By following the procedure above, your site is now visible on the new server, although there are some more things that need to be fixed, depending upon your blog plugins and usage. Like upload directory and already uploaded images and files paths, internal links inside the articles etc. If they are just a few, you can do them manually, otherwise you need to do it through database / or wordpress extensions.

hire best wordpress php css developer
Need Help? Hire me now!
I can help you in anything related to webdevelopment, including: HTML, CSS, PHP & MySql, WordPress (plugins & themes development, others), regular expressions, server management, etc.

10 comments on “How to Transfer WordPress from one server to another

  1. No, not at all. I will not get this theme in the first place. But yeah, almost any popular theme including Thesis 1.6 is available for free download!

    I was shifting to wordpress.org but found some tech issues and postponed it; I will shift later; will get some free Woo theme or some other mag theme [they are many great free themes]

    BTW, you have installed a nice email reply plugin; it drives traffic back here and does not show the reply in mailbox only [and one is subscribed to it by deafault]!

  2. As noted in your instructions, what should I set as the permissions, etc. when I create the new DB to receive the uploaded DB from my old system? thanks.

Leave a Reply to Muhammad Qasim Cancel reply

Your email address will not be published.