<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Snow Giraffe Tech &#187; split blog</title>
	<atom:link href="http://www.snowgiraffe.com/tech/tag/split-blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.snowgiraffe.com/tech</link>
	<description>rails, rubies, and sometimes dolphins</description>
	<lastBuildDate>Mon, 07 Jun 2010 14:36:05 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Two blogs are better than one</title>
		<link>http://www.snowgiraffe.com/tech/316/moving-blogs/</link>
		<comments>http://www.snowgiraffe.com/tech/316/moving-blogs/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 01:42:50 +0000</pubDate>
		<dc:creator>blythe</dc:creator>
				<category><![CDATA[Coding and Computers]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[Dreamhost]]></category>
		<category><![CDATA[duplicate blog]]></category>
		<category><![CDATA[split blog]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.snowgiraffe.com/tech/?p=316</guid>
		<description><![CDATA[Tech people don't care about the pow, and snow folk dont care about coding. So I split my wordpress blog into two using awesome amazing tech powers.]]></description>
			<content:encoded><![CDATA[<p>So it turns out that not as many folks who care about MySQL and Ruby on Rails want to hear about drinking sparks and snowboarding. Wtf people? Anyhoo, now I have two blogs for your enjoyment.</p>
<ul>
<li><a href="http://snowgiraffe.com/tech">Snow Giraffe Tech</a> &#8211; this tech talk blog</li>
<li><a href="http://snowgiraffe.com/blog">The Snow Giraffe Blogs</a> my personal funtime blog about the snow gnar, the sparks, people I like, and general awesome</li>
</ul>
<p>If you care to know the intimate details of how I duplicated and split and retained all my old relevant posts with <a href="http://wordpress.com/">Wordpress</a> and <a href="http://www.dreamhost.com/">Dreambutt</a> (ok, yes I have been referring to Dreamhost by a better name for way too long), read on about my SQL poweress. (Also, I have always wanted to blog about blogging.)</p>
<h1><span id="more-316"></span>How to split or duplicate your wordpress blog</h1>
<p>First, I hate IT. I am not an IT expert. I can move files around and write queries and begrudgingly edit php files. This is dangerous probably, but hey it worked for me.</p>
<p>The examples assume the following data for the new and old blogs. It assumes that your current directory is</p>
<pre>/blah/blah/www</pre>
<h4>Original blog</h4>
<pre>url: host.com/blog  
directory on server: /blah/blah/www/blog
database: wordpress_blog
database host: blog.myhost.com</pre>
<h4>New blog</h4>
<pre>url: host.com/blog
directory on server: /blah/blah/www/new_blog
database: wordpress_new_blog
database host: blog.myhost.com</pre>
<h3>Upgrade your existing blog</h3>
<p>Upgrade your blog to which ever you want to use for the new one.</p>
<h3>Install Wordpress in a new directory</h3>
<p>I am using dreambutt, so I used the one-click installer (Goodies -&gt; One Click Installer) to install a new blog to my directory. If you don&#8217;t have such luxuries, than you can probably figure out <a href="http://codex.wordpress.org/Installing_WordPress">how to install wordpress</a>.</p>
<p>Some guidelines:</p>
<ul>
<li>Use a new directory</li>
<li>Use a new database (okay you can reuse the old but be careful)</li>
<li>Host can be shared</li>
</ul>
<h3>Dump and replace your old database</h3>
<ul>
<li>Dump your old database (wordpress_blog).</li>
<li>Update references to host.com/blog to host.com/new_blog</li>
<li>Update references to server directories: /blah/blah/www/blog to /blah/blah/www/new_blog</li>
<li>Import into your new blog database (wordpress_new_blog)</li>
</ul>
<pre>mysqldump -uusername -ppassword -hblog.hyhost.com wordpress_blog &gt; wordpress.sql
sed 's/host\.com\/blog/host\.com\/new_blog/g' wordpress.sql &gt; wordpress_new1.sql
sed 's/www\/blog\/wp/www\/new_blog\/wp/g' wordpress_new1.sql &gt; wordpress_new2.sql
mysql -uusername -ppassword -hblog.myhost.com wordpress_new_blog &lt; wordpress_new2.sql</pre>
<p>If you don&#8217;t feel comfortable updating the sql before importing it. Skip the SED tasks. However, make sure that you update the columns with the following option_names in the options table:</p>
<pre>+--------------------------------------+
| option_name                          |
+--------------------------------------+
| siteurl                              |
| home                                 |
| recently_edited                      |
| upload_path                          |
| dashboard_widget_options             |
+--------------------------------------+</pre>
<h3>Backup and copy the new blog</h3>
<p>Backup the new blog then recursively copy the old to the new directory.</p>
<pre>mv /blah/blah/www/new_blog /blah/blah/www/new_blog.new
cp -r /blah/blah/www/blog /blah/blah/www/new_blog</pre>
<h3>Change the configuration</h3>
<p>Change new_blog/wp-config.php to point to the new database. You might want to open it up and change other details as well.</p>
<pre>// ** MySQL settings ** //
define('DB_NAME', 'wordpress_new_blog');     // The name of the database</pre>
<p>I ran this real quick:</p>
<pre>sed 's/wordpress_blog/wordpress_new_blog/'  new_blog/wp-config.php &gt; new_wp-config.php
cp new_wp-config.php new_blog/wp-config.php</pre>
<h3>Login to the new blog</h3>
<p>You should be able to login on host.com/new_blog with the same credentials you used on the original blog. The styles, posts, etc should be exactly the same. You probably want to:</p>
<ul>
<li>Delete (in bulk) and posts and media that you no longer want.</li>
<li>Update the blog name, settings, etc particular to your new blog.</li>
</ul>
<h3>Backup and copy the new blog</h3>
<p>Cleanup your mess.</p>
<ul>
<li>Remove temporary files we created</li>
</ul>
<pre>rm -r wordpress*.sql
rm new_wp-config.php</pre>
<ul>
<li>Remove backup directoried (if desired)</li>
<li>Remove old media files either directly on the server or log into the new blog</li>
<li>Repeat for the original blog if necessary</li>
</ul>
<h3>Thats it!</h3>
<p>If you have any troubles, examine the new_blog/wp-config.php file.</p>
<p>Connect to the new database and make sure references to the old blog are removed from the options table.</p>
<p>If at any point you mess up, drop the database, revert to the original (temp.orig) and start again.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.snowgiraffe.com/tech/316/moving-blogs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
