Cloning WordPress for multiple installs
Posted 3rd May 2010 at 03:46 PM by Austin Delaney
update: I now use the excellent 'Duplicator' plugin that is completely gratis courtesy of Life In The Grid - find it in the WordPress plugin directory:
http://wordpress.org/extend/plugins/duplicator/
---------------------
If you are creating a lot of blogs that are identical in their configuration (plugins, theme, settings) you can save a lot of time by creating a master blog that can be replicated with ease if you have cpanel hosting.
To prepare your master blog you will need to set up your blog exactly as needed (including plugins and theme) and then zip up all of the contents in your web folder (/public_html/)
This will be your master blog file.
The next step is to backup your master blog MySQL database as this has all of your settings for the plugin, theme and any pages/posts you have created. You can do this with phpMyAdmin by selecting the WordPress database and exporting it to your computer. i.e. download the .sql file.
The first thing to do to replicate your blog on another domain is to upload the zip file to the public_html folder of the new domain and then unzip the contents.
Secondly, create a new MySQL database using the cpanel MySQL wizard and copy the db name, username and password details to a text file.
Now open wp-config.php (in your public_html folder) for editing.
Replace the details of your master blog db name, username and password with the new db details and save the file.
The next step is to goto your new MySQL database with phpMyAdmin.
The database should be blank (no tables etc).
Click on import and select your master blog .sql file that you saved to your computer earlier.
After the database has been imported you will need to update some details before you can begin using your WordPress install on the new domain.
Make sure you have the new database selected (click on the db name on the left) and then click on 'SQL'. You are going to run a few SQL queries to update the database with details of your new domain.
Enter the following into the text box:
UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-domain.com', 'http://www.new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com','http://www.new-domain.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-domain.com', 'http://www.new-domain.com');
Make sure to replace http://www.old-domain.com and http://www.new-domain.com with your details.
If you have made use of the wp-content/uploads directory you will also need to update the path to this directory.
Again, make sure you ahve the right database selected by clicking on the db name in the left hand side column and then click on search.
Search for 'upload' with all of the tables selected (select all).
In the results table click on 'browse' for 'inside table for wp-options'
Then click on the little pencil icon next to 'upload_url_path'
You will need to replace the path with the full path to your wp-content directory
Eg; /home/your_user_name/public_html/wp-content/uploads
Once you've done that just click on 'Go' and then login to your new WordPress install at http://www.your-domain.com/wp-login.php using your username and password from your master blog.
Enjoy :]
http://wordpress.org/extend/plugins/duplicator/
---------------------
If you are creating a lot of blogs that are identical in their configuration (plugins, theme, settings) you can save a lot of time by creating a master blog that can be replicated with ease if you have cpanel hosting.
To prepare your master blog you will need to set up your blog exactly as needed (including plugins and theme) and then zip up all of the contents in your web folder (/public_html/)
This will be your master blog file.
The next step is to backup your master blog MySQL database as this has all of your settings for the plugin, theme and any pages/posts you have created. You can do this with phpMyAdmin by selecting the WordPress database and exporting it to your computer. i.e. download the .sql file.
The first thing to do to replicate your blog on another domain is to upload the zip file to the public_html folder of the new domain and then unzip the contents.
Secondly, create a new MySQL database using the cpanel MySQL wizard and copy the db name, username and password details to a text file.
Now open wp-config.php (in your public_html folder) for editing.
Replace the details of your master blog db name, username and password with the new db details and save the file.
The next step is to goto your new MySQL database with phpMyAdmin.
The database should be blank (no tables etc).
Click on import and select your master blog .sql file that you saved to your computer earlier.
After the database has been imported you will need to update some details before you can begin using your WordPress install on the new domain.
Make sure you have the new database selected (click on the db name on the left) and then click on 'SQL'. You are going to run a few SQL queries to update the database with details of your new domain.
Enter the following into the text box:
UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-domain.com', 'http://www.new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com','http://www.new-domain.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-domain.com', 'http://www.new-domain.com');
Make sure to replace http://www.old-domain.com and http://www.new-domain.com with your details.
If you have made use of the wp-content/uploads directory you will also need to update the path to this directory.
Again, make sure you ahve the right database selected by clicking on the db name in the left hand side column and then click on search.
Search for 'upload' with all of the tables selected (select all).
In the results table click on 'browse' for 'inside table for wp-options'
Then click on the little pencil icon next to 'upload_url_path'
You will need to replace the path with the full path to your wp-content directory
Eg; /home/your_user_name/public_html/wp-content/uploads
Once you've done that just click on 'Go' and then login to your new WordPress install at http://www.your-domain.com/wp-login.php using your username and password from your master blog.
Enjoy :]
Total Comments 5
Comments
-
Posted 3rd May 2010 at 04:37 PM by proserve -
Posted 3rd May 2010 at 04:59 PM by Istvan Horvath - Thanks for the education.
Posted 1st June 2010 at 08:35 PM by multistreams -
Posted 6th July 2010 at 10:40 PM by josher - Hi Austin,
Thank you for your excellent guide!
This is almost exactly the same procedure that you use to follow. It's quite easy once you've tried it a couple of times, and you spare a lot of money by not buying one of these software applications that promise to do the same job but often disappoint.
Thanks again!
Best,
KlausPosted 11th August 2010 at 03:28 AM by kd777