How to move WordPress to a new host

Once I got the new domain name bluegalaxy.info, I wanted to move my blog over to the new domain. It was previously hosted on my laptop with a local apache installation at:
http://1uslchriston.ad.here.com:8080/blog

On the new domain, I wanted to change the landing from “blog” to “codewalk”, and I also don’t need to use port 8080.

Here are the three steps it took to move my WordPress blog to the new domain and host:

 

Step 1: Update values in wp-config.php

I updated the MySQL settings in the wp-config.php file that is located in the /blog folder. Note: Make a backup copy of wp-config.php first!

These four settings need to be adapted for the new domain name:
(DB_NAME, DB_USER, DB_PASSWORD, DB_HOST)

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'new_dbname');

/** MySQL database username */
define('DB_USER', 'new_username');

/** MySQL database password */
define('DB_PASSWORD', 'new_password');

/** MySQL hostname */
define('DB_HOST', 'new_host_mysql');

 

Step 2: Copy WordPress files to the new location

I copied all WordPress files from the /blog folder on my laptop to the new location of /codewalk on my new host, via FTP. This includes all folders AND files inside /blog, including .htaccess and all of the wp-config.php files.

 

Step 3: Update wp_option values in the MySQL database

I updated wp_option values via SQL query in the new MySQL database. For example:

UPDATE wp_options SET option_value = replace(option_value, 'http://1uslchriston.ad.here.com:8080/blog','http://bluegalaxy.info/codewalk') WHERE option_name = 'home' OR option_name = 'siteurl';

This edit was made in the phpMyAdmin tool found via the MySQL icon in the control panel of my new host. There is an SQL option where you can run custom queries and commands. For example:

This SQL query basically updated the ‘home’ and ‘siteurl’ values in the database with the new URL.

And voila! Once allĀ  three steps are done, simply point your browser at the new blog location.

Leave a Reply