Oct
09
2011

Transfer WordPress with Content

Anyone with a blog has been there, at some point you want to start anew on a new server, perhaps with a new domain name and the one bad thing about WordPress is that it is extremely hard to take with you.  It always feels like starting over.

Here’s a tutorial on how to export WordPress with all it’s content to a new domain and server by webtrafficgeeks.com

Step 1: Back up your Word Press database and load onto new sever

Most servers with MySql come with phpMyAdmin, here is a tutorial on how to back up the database.  Normally reloading the database is as simple as going to the “Import” tab in phpMyAdmin and selecting the sql back-up file.  If your account does not allow you to create databases, here is a tutorial.

Step 2: Back up the Word Press directory and load onto new server

Pick out your favorite FTP client and download the entire directory for the blog verbatim, and upload to the new server.  It should be possible to even rename the directory, or otherwise change the file structure if desired.

Step 3: Directly edit the blog location on the MySql table

Log back into phpMyAdmin select the new Word Press Database in the left hand column the tables will list out select “_options”.  The table structure should load, select the browse tab.

The first row of the table should be title “siteurl” and edit the row (aka click the pencil)

Enter the new URL of the blog.

Step 4: Edit the wp-config.php

The file “wp-config.php” should be in the main directory of your wordpress blog.  Open the file in your favorite editor.

/** WordPress’s config file **/
/** http://wordpress.org/   **/

// ** MySQL settings ** //
define(‘WP_CACHE’, true); //Added by WP-Cache Manager
define(‘DB_NAME’, ‘DBName‘);     // The name of the database
define(‘DB_USER’, ‘User‘);     // Your MySQL username
define(‘DB_PASSWORD’, ‘Password‘); // …and password
define(‘DB_HOST’, ‘mysql.servername.net‘);     // …and the server MySQL is running on

Save the file and then visit the blog on the new URL.  Everything should work fine!

Why does it need to be done this way?

WordPress is run via PHP and a MySql database, and they communicate a lot of important information to one another.  The PHP holds the structure and sorting mechanism for your blog (e.g. the layout), and the database holds all the information (e.g. the entries). However, the most important bit of information they communicate is that the PHP knows the location of the database, and the database knows the location of the website.

This is what makes WordPress so hard to port because without hard coding the new location of the database in the PHP, and the new location of the website into the database your blog essentially has no idea where it is.  It has no way of knowing it’s physical location, or accessing it’s data.

There is a WordPress tutorial linked below, but it will only function if you still have access to the blog at it’s first location, and the blog will be disabled until it is moved to the new location, as it depends on editing the database via the Word Press interface.  Once this is action is taken Word Press will believe it is at the new location and most of the application will not work properly.

Have you tried this?

My test included all the steps other than reloading the database, I had a blog on a now expired domain and I needed to remap it to a subdomain.  To reload the blog I needed to complete steps 1,3 and 4.  I code PHP and MySql on my own and have reloaded many databases in my time, so step 2 should work fine.  Theoretically there should be no issue with renaming the database or moving/renaming the blog directory so long as steps 3 and 4 are completed.

The Official WordPress Tutorial

Leave a Reply

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


*

CommentLuv badge