Last night I was up till 5a.m. getting the final step of my blog upgrade done – moving it to its own domain (see that up there? www.narrativedisorder.com ? that was HARD, that was lol). I’m not deluded that many people read it or that there was an urgency at all but it was a new challenge damn it! And it was one of those thing where you are just holding on to all the new info and if you stop before it all coalesces into sense you’ll never understand it!

In the end it actually wasn’t that hard but since I spent 7 hours and what felt like a large amount of our download limit attempting at least 6 different variations on "how to" guides, first from wordpress.org then from desperate google searches, and finding each one to be incompatible with my own hosting situation in someway or missing or assuming a vital element or understanding here or there, (deep breath) I figured I’d do my bit to help other people like me (with more courage than knowledge OR sense) and give you the "How to" I would have liked to find last night. Maybe it will help someone. If you read through this and feel trepidation about following the first few steps then you should probably either leave things as they are or get yourself a blog host who can do everything for you. After all, this is very similar to upgrading to another wordpress version which will need to be done at least every couple of years so you probably need someone else to do it for you.

Important note: my new domain is registered under and hosted under the same plan as my other domains and so the databases were going to be on the same server – I have no idea how that effects things but I’m assuming it has some effect (THAT’s what a newbie I am to this stuff – I probably shouldn’t have a self-hosted worpress but I love working this stuff out hehe)

The process is divided into the following sections (as soon as I wrestle out how to make these anchors for jump-to links I will 🙁 ):

BACKING UP YOUR CURRENT WORDPRESS DATABASE
BACKING UP YOUR CURRENT WORDPRESS FILES
CREATING AND CONFIGURING YOUR NEW DATABASE
CREATING AND CONFIGURING YOUR BLOG ON YOUR NEW DOMAIN
NEARLY THERE – A FEW LAST, IMPORTANT THINGS

 

HOW TO:

1) FIRST BACK UP YOUR FILES AND DATABASE – I CANNOT STRESS ENOUGH HOW IMPORT THIS IS!

If you are confident with backing up our database and files then skip to NOW TO YOUR NEW SITE

"Back-up" is simply jargon for making a copy of your files as they are at a certain time so that if you try to change something and it doesn’t work out you can return the files to the state they were in before you mucked around (or the server crashed or was infected or whatever) If this "how to" doesn’t work you will need these files to return your blog to the state it is in now – you should be doing this regularly anyway but I know I only learned how to do it recently and a lot of people don’t so, no judgement or assumed knowledge, here’s how to do it:

note: these instructions are for phpMyAdmin which is what many hosts will give you to work with – if it’s something else then find out what is right for you.

Remember there are 2 things to back up – your files (wp_content/themes etc…) and your Database

BACKING UP YOUR DATABASE

  1. On your computer, make yourself a folder in which you will store your backups – put it anywhere you like which fits your organization (mine I put mine in the same place I keep all my blog back-ups and named it "blogmovefiles" to isolate it but if you need to put it on your desktop to make it clearer to you then do that)
  2. Login to phpmyadmin of your old blog database in whichever way your host gives you (if this scares you or can’t work out how to do it from FAQs provided by your host, seriously consider getting a non-self-hosted blog)
  3. You will see tabs across the top of the page (looking like a really poor old fashioned web page lol) but first look at the column on the left and find your database name (it will be in the left panel and won’t look like a button or a link – just text and will have an alphanumeric name which won’t necessarily make any sense to you) – click this and you should see your DB tables come up in the main window with check boxes beside them.
  4. Click the "check all" link underneath your tables
  5. Click the export tab
  6. Click the Structure and Data radio button
  7. Click "Save as file"
  8. Click "Go"
  9. You will see a "browse" window – click it and find where you want to save (just like you would to save any file you are downloading to disk) and click "Save"

When the download is complete – you have backed up your DB! Close the window phpMyAdmin is in.

 

BACKING UP YOUR FILES

The files are probably more familiar to you – these are the files which sit in the directory to which IE or Firefox point and they tell the browsers how to layout the page and how to communicate with the database you just backed up etc… If you have ever uploaded a theme to use on your blog (without using some plugin to do it) then you have seen your file director.

There are a couple of ways to do this: using an ftp application like filezilla or using whatever file management application your host provides you (my host has quite a good web-based application but I am used to ftp from the command line days so I prefer to use filezilla)

  1. Login in to your current blog ftp site either using your ftp application or your hosts web-application
  2. If you are using filezilla or similar ftp app: click through the local folder tree to open the file into which you are going to store these files – giving it a file next to your database back up is a good idea.
  3. Click your way through the file structure on your site till you find your current blog folders and files (in other words to the directory which is also your blog address) highlight all the folders and files in that directory

If you are using your hosts file management system no doubt there will be an option to copy whichever checked or highlighted files and you will be given "save to disk" option withthe usual "browse" function to choose where to save – but you will have to work that out for yourself -this will start them copying form your site to your computer

4. If you are using filezilla simply drag the highlighted files and folders to the open folder on the left panel and wait for the files to flicker through the queue until it is done

Whichever method you are using, this will take quite some time so grab a cuppa and watch a video or occupy yourself somehow while it happens – but be around in case any errors pop up (which they shouldn’t)

Note that most ftp servers have a time-out limit which will be much shorter than the time it will take to do this. If you are using filezilla the right hand panel in which you could click through to your website (the remote host) will go blank but for a message saying that you are no longer connected to the site when the time-out limit is reached. You will notice, though, that the queue will keep flickering – this is because it will be in "passive mode" which basically means that it will keep going connecting and reconnecting by itself till it is done but you won’t be able to view your files. Don’t do anything, don’t try  to reconnect just wait for it to do its thing.

5. When it says it is done – verify all the files have been uploaded by comparing it to the local files and folders in your backup folder

When the queue is finished – congratulations! You have backed up your files!!

NOW TO YOUR NEW SITE

CREATE AND CONFIGURE YOUR NEW WORDPRESS DATABASE

2) Create a new, blank database on your server – your host should give you a way of doing this and I am not going to give any advice just follow their instructions – with my host it is literally a one click process. IMPORTANT NOTE DOWN THE DATABASE NAME, THE NEW ADMIN USER NAME THEY PROVIDE AND THE PASSWORD These will all be odd alphanumeric things which should be easy to locate or at the least should also be sent to you via email when you create the database. The best way to note this down is to copy and paste into a text file you can easily access, say on your desktop – or make sure you know where your email is – you will need this information at the end.

3) Configure and populate your new database in one go! Essentially all you need to do is import the .sql file which you exported from your old database. Here’s how to do it with phpMyAdmin (you will have to work out anything else yourself):

  1. Login to phpMyAdmin on your new database
  2. Just as before, click the database name on the top left
  3. Click either the Import tab or the SQL tab if there is no Import tab (I assume this is a variance between version of phpMyAdmin)
  4. Find the "browse" button and click and navigate to your backup .sql file
  5. Click "go"
  6. When it’s finished, click the "structure" tab and you will see that your new database now looks like your old one did

4) Update your new database with your new domain info – the following instructions are essentially how to do find and replace function via SQL – don’t panic just follow the instructions carefully

  1. Still in phpMyAdmin, click the "SQL" tab
  2. You will see a largish blank box with something like "Run SQL query/queries on database <your db name>"  above it
  3. Into the blank box copy and paste all of the following: 
    UPDATE wp_options SET option_value = replace(option_value, ‘ http://www.old-name.com’, ‘http://www.new-name.com’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’;

4.  Once you have pasted it in, replace http://www.old-name.com with your old web address (include /blog or /wordpress if necessary) – making sure to leave the apostrophes around it and similarly with http://www.new-name.com with your new blog address.

5.  Double check you have got all your spelling exactly right then click "go"

6.  You should get a nice confirmation message – IF you get a long wall of text with the word error scattered through don’t panic, just click the "back" button at the bottom and double check your spelling etc… of the old and new addresses and try again

7.  Once you get your confirmation message, highlight everything you pasted into the blank box and delete it so that it is blank again – you now need to do the same thing another two times with slightly different commands:

8.   Into the blank box copy and paste all of the following: 
UPDATE wp_posts SET guid = replace(guid, ‘http://www.old-name.com’, ‘http://www.new-name.com’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’;

9.  Again, replace http://www.old-name.com with your old web address (include /blog or /wordpress if necessary) – making sure to leave the apostrophes around it and similarly with http://www.new-name.com with your new blog address.

10. Double check you have got all your spelling exactly right then click "go"

11. Once you get your confirmation message, highlight everything you pasted into the blank box and delete it so that it is blank again – now for the last one!

12. Into the blank box copy and paste all of the following:  
UPDATE wp_posts SET post_content = replace(post_content, ‘http://www.old-name.com’, ‘http://www.new-name.com’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’;

13. Again, replace http://www.old-name.com with your old web address (include /blog or /wordpress if necessary) – making sure to leave the apostrophes around it and similarly with http://www.new-name.com with your new blog address.

14. Double check you have got all your spelling exactly right then click "go"

15. Once you have that final confirmation – well done, you have now changed your blog address in your database!

DO NOT TRY TO TEST YOUR SITE YET

Now, what do with those file backups

  1. CREATE AND CONFIGURE YOUR BLOG ON YOUR NEW DOMAIN
  2. Essentially this is your wordpress install and it’s really easy
  3. Login to your ftp site using your ftp application (like filezilla) or whatever your host provides you with to upload multiple files in such a way that you maintain directory structure (this is why I prefer to use an ftp application – it’s so easy!)
  4. In your remote host panel (right frame in filezilla and most other ftp applications) click through to the directory which you just typed in when you replaced http://www.new-name.com in the SQL process (DO NOT CHANGE YOUR MIND NOW lol)
  5. In your local host panel (left frame in filezilla and most other ftp applications) find your backed up files and highlight them all, files, folders, the lot
  6. Drag the files from your computer (the local host panel) to your site (the remote host panel)
  7. Again you will need to find something to do while this uploads- it will probably take a little longer than your back-up took
  8. When it says it is done – verify all the files have been uploaded by comparing it to the local files and folders in your backup folder
  9. DO NOT TRY TO TEST YOUR SITE YET

 

NEARLY THERE – A FEW LAST, IMPORTANT THINGS

Easy things first:

  1. Still in your ftp application, click your way to your new /wp_content/cache delete this folder then log out from your ftp site (you’ll be coming back but for now it’s safer to log out)
  2. Open your web browser and delete your cache and cookies


Less easy thing now but critical.

What you now have is a lovely new database and a lovely new install of wordpress but they are not yet talking to each other.

  1. The file that connects them is the wp-config.php file which is one of the files in the directory that is your wordpress address – this file needs to be changed
  2. Find the database name, username and password which you noted down when you created your new database (if you didn’t note it down then go to your database administration panel which your host provides on your site control panel/dashboard and find it)
  3. Now find the wp-config.php file in the back up you made and highlight and copy it.
  4. Right click anywhere on your desktop and choose paste – you now have a copy isolated from your backup copy and safe to play with 🙂
  5. Now, open this file in notepad (double clicking should do this but if you are prompted to choose a file to open it in then choose notepad) Inside it should look something like this:

<?php
// ** MySQL settings ** //
define(‘DB_NAME’, ‘d1234567’);    // The name of the database
define(‘DB_USER’, ‘u12345678’);     // Your MySQL username
define(‘DB_PASSWORD’, ‘abc1234’); // …and password
define(‘DB_HOST’, ‘MYSQLHOST’);    // 99% chance you won’t need to change this value
define(‘DB_CHARSET’, ‘utf8’);
define(‘DB_COLLATE’, ”);

// Change SECRET_KEY to a unique phrase.  You won’t have to remember it later,
// so make it long and complicated.  You can visit https://www.grc.com/passwords.htm
// to get a phrase generated for you, or just make something up.
define(‘SECRET_KEY’, ‘letmein’); // Change this to a unique phrase.

// You can have multiple installations in one database if you give each a unique prefix
$table_prefix  = ‘wp_’;   // Only numbers, letters, and underscores please!

// Change this to localize WordPress.  A corresponding MO file for the
// chosen language must be installed to wp-content/languages.
// For example, install de.mo to wp-content/languages and set WPLANG to ‘de’
// to enable German language support.
define (‘WPLANG’, ”);

/* That’s all, stop editing! Happy blogging. */

define(‘ABSPATH’, dirname(__FILE__).’/’);
require_once(ABSPATH.’wp-settings.php’);
?>

6.   Very carefully without touching or moving anything else, change the following:

In:
define(‘DB_NAME’, ‘d1234567’);    // The name of the database

change d1234567 to your new database name

In:
define(‘DB_USER’, ‘u12345678’);     // Your MySQL username

change: u12345678 to your new database admin user name

In:
define(‘DB_PASSWORD’, ‘abc1234’); // …and password

change: abc1234 to your new database admin password

7.   Save the file

8.   Now log back in to your ftp site using either filezilla or the file management facility provided by your host

9.   In the local host panel navigate to your desktop and find the wp-config.php file.

10.  Drag the file over to the wordpress directory – the file will begin to copy and you should get a confirmation dialogue asking if you want to over write the old wp-config.php file – select over-write and click ok (if you do not get this then you have uploaded it to the wrong place – simply find where you put it, delete it and try again)

11.   Log out of your ftp site

 

NOW you can go to your new blog address and test that everything works!

You will not have a cookie for logging in to that address so you will have to log in again – if you have forgotten your password simply use the "forgotten password" link and it will be sent to you.

Wow that’s a long post and it’s a long process but not actually hard and I’m pretty sure I’ve covered everything. Again, if you read through this and don’t feel that you can at least follow along then you should probably either leave things as they are or get yourself a blog host who can do everything for you.

 

GOOD LUCK!!!