How to transfer wordpress installation from one server to another?

Pin It

Suppose, you are migrating you wordpress installation from one server to the other. In this case, you might have a different database server, database username and password. You might also have a different domain name as well. A general scenario will be migrating you wordpress installation from your localhost (local installation on your computer) to any online server.

In this case, you need to consider few things to make the site working. You need to make changes in wp-config.php (present in root directory of wordpress installation) and some update in wp-options table of your database.

Changes in wp-config.php

I suppose that my database name is wordpress, database username is root, password is pass and database server name is localhost.

/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');
 
/** MySQL database username */
define('DB_USER', 'root');
 
/** MySQL database password */
define('DB_PASSWORD', 'pass');
 
/** MySQL hostname */
define('DB_HOST', 'localhost');

Changes in database (wp-options table)

1) In wp-options table, search for siteurl and home in option_name column.

SELECT * FROM `wp_options` where `option_name` = 'siteurl' OR `option_name` = 'home';

2) Then edit the option_value column for the two rows with your current site url. I have supposed your current url as http://example.com. You can put your own url.

UPDATE `wp_options` SET `option_value` = 'http://example.com' WHERE `wp_options`.`option_name` = 'home' ;
 
UPDATE `wp_options` SET `option_value` = 'http://example.com' WHERE `wp_options`.`option_name` = 'siteurl' ;

2 total comments on this postSubmit yours
  1. Thanks for the quick tip.

  2. I’ve seen this quick method before. However, if you have hardcoded any URLs or images in post/pages, you need to update these also. This means opening the database in a good text editor and doing a search and replace for old URL and replacing with new URL. This applies if you have changed domains. There is also a plugin called search regex or something that allows a global search replace.

4 total pingbacks on this post
Submit your comment

Please enter your name

Your name is required

Please enter a valid email address

An email address is required

Please enter your message

Twitter

  • May 2, 2012 04:15

    10 Free WordPress Theme To Make You Forget About Premium Theme http://t.co/YRiLCiVa

  • March 2, 2012 17:16

    3 Helpful Tools to Test Cross Browser Compatibility of Webpage http://t.co/FY0jh8Dn

  • March 2, 2012 16:43

    3 Helpful Tools to Test Cross Browser Compatibility of Webpage http://t.co/QUlYKInf #IE #FF #Chrome #Testing #CrossBrowser

  • March 2, 2012 12:52

    Top 5 Plugins to Build Contact Form for WordPress http://t.co/PWyR08Iq #WordPress #Plugins #ContactForm

  • June 11, 2011 02:49

    CSS 3 Transitions http://bit.ly/m0pK3t

Design Gala © 2012 All Rights Reserved

Designed by 76miles

Powered by WordPress

More in How to, WordPress (51 of 60 articles)