rashbre central: moving a Wordpress site

Wednesday 29 June 2011

moving a Wordpress site

wordpress-logo
This is one of my occasional geeky technical posts (use at your own risk etc.)

It will save me time if I have to do this again.

Simply put, I needed to move a Wordpress site from one directory and url to another. Ideally without having to export it all, rebuild the database and re-import it.

My steps were as follows:

1) Go to the current directory and download the wp-config.php file

2) Add two 'define' lines to it as follows:

/** Temporary lines to redirect the site to the new directory */
define('WP_HOME','http://www.mynewsite.com/newplace');
define('WP_SITEURL','http://www.mynewsite.com/newplace');


3) Copy the existing web site folder to the new place using ftp. I use Yummy FTP for this.

4) Copy the edited wp-config.php file to the new place using FTP.

5) Try the new location. It should now work. Look carefully at the browser to ensure it is actually going to the new location. Also try the Wordpress dashboard. If they work then I suggest using FTP to rename the old web site directory and trying again. If it still works then leave the old directory intact for a few days until certain that everything is functioning.

6) If it's all working, re-edit the wp-config.php and remove the temporary lines and re-upload. Don't try to make this change from within the Wordpress dashboard. It will all go horribly wrong. Trust me.

7) If the new site location doesn't work, it is likely the website root directory index.html (or Welcome) may need to be re-edited to point to the new folder. Download it with FTP. It's only a couple of lines. Look to see if there is a pointer to the oldplace and if so, edit it for the newplace.

8) Time taken to do the transfer (keeping the same SQL database) = 10 minutes plus the FTP copy time of the Wordpress directory (in my case about 15 minutes).

And all happy happy smile smile again at the end.

2 comments:

Ellie said...

I want to know why Wordpress instead of Blogger.

rashbre said...

Ellie : My wordpress sites are a whole other story.