Home » Computing » Moving wordpress

Moving wordpress

I just moved my WordPress blog from its old location on a regular webhost to a new location on a VPS.

I just wanted to share some learning notes on how to go about it – I can imagine they’ll be useful to me too in the future!

[EDIT — I have just checked the official way of doing this and I must say, it seems much more involved. I think it might be old and many issues are now resolved, but for the sake of caution, here’s their instructions {2013-06-13 : http://codex.wordpress.org/Moving_WordPress} I was using wordpress 3.9 during the upgrade]

  1. Get a dump of the database dedicated to your wordpress instance as an SQL file – it contains the actual posts and comments from your blog
  2. get a copy of your full wordpress directory – any media files uploaded are here, along with the actual PHP pages
  3. copy these over to the new location
  4. (unpack the wordpress web directory to the desired web directory, if necessary)
  5. re-create the same user in your new DBMS instance, and use the same password (you can find that in wp-config.php file in your wordpress web files), granting it the appropriate permissions
  6. restore the database by using the SQL dump file from your earlier backup – this will restore the entire database as a complete copy – for example, run the SQL file through your DBMS’s CLI tool
    • $> mysql -u wpuser -p"wp_password" < wpdb_dump.sql
  7. log in to the database and run the following, where “http://example.com” is the base URL of your new wordpress blog – wordpress redirects any access to wp-admin to this URL, so it needs updating or you’ll always go back to the old URL’s wordpress
    • update wp_options set option_value='http://example.com/' where option_name='home' or option_name='siteurl';
  8. In the wp-config.php file in the root of your wordpress directory, change the DB_HOST property to point to the new database location

You should now be able to go to the new URL and everything should be as it was!

 

Posted in Computing, Tai's FWA

Leave a Reply

Your email address will not be published. Required fields are marked *