<?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>Chris Hardcastle &#187; wordpress</title>
	<atom:link href="http://chrishardcastle.co.uk/tag/wordpress/feed" rel="self" type="application/rss+xml" />
	<link>http://chrishardcastle.co.uk</link>
	<description>Facebook App and Website Developer</description>
	<lastBuildDate>Wed, 23 Feb 2011 00:42:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>WordPress absolute path update</title>
		<link>http://chrishardcastle.co.uk/wordpress-absolute-path-update</link>
		<comments>http://chrishardcastle.co.uk/wordpress-absolute-path-update#comments</comments>
		<pubDate>Tue, 30 Jun 2009 21:47:42 +0000</pubDate>
		<dc:creator>chris.hardcastle</dc:creator>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[sed]]></category>

		<guid isPermaLink="false">http://chrishardcastle.co.uk/?p=53</guid>
		<description><![CDATA[I have just found a really helpful command that I can see myself using all the time. It&#8217;s too often that I need to take a copy of a development database file and update the absolute paths to use the &#8230; <a href="http://chrishardcastle.co.uk/wordpress-absolute-path-update">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I have just found a really helpful command that I can see myself using all the time. It&#8217;s too often that I need to take a copy of a development database file and update the absolute paths to use the live address.<br />
<span id="more-53"></span><br />
Imagine you have a .sql file that you have created by exporting a wordpress database. That can be done using the mysqldump command over the command line in Linux/Ubuntu. Now you want to replace all (global) occurrences of &#8220;local&#8221; with &#8220;live&#8221; in a file called &#8220;data.sql&#8221; and catch the results in a new file called &#8220;new.sql&#8221; the code would be as follows.</p>
<p><code><br />
sed -e 's/local/live/g' data.sql > new.sql</p>
<p></code><br />
A new file should be created called &#8220;new.sql&#8221; with the replacements made. SED is a tool available in all Linux distributions and can be accessed via the command line. The &#8220;e&#8221; command runs the function with the script that follows in quotes. The &#8216;s&#8217; command treats the arguments as separate files. The &#8216;g&#8217; means global. This makes a replacement on multiple lines.</p>
<p>This is an interpretation based on guidance from this<a href="http://www.ibm.com/developerworks/linux/library/l-sed2.html"> following article</a> it&#8217;s a very simple example. For my own reference really, but I hope you find useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://chrishardcastle.co.uk/wordpress-absolute-path-update/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress site preview</title>
		<link>http://chrishardcastle.co.uk/wordpress-site-preview</link>
		<comments>http://chrishardcastle.co.uk/wordpress-site-preview#comments</comments>
		<pubDate>Wed, 17 Jun 2009 00:26:13 +0000</pubDate>
		<dc:creator>chris.hardcastle</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[.htaccess]]></category>

		<guid isPermaLink="false">http://chrishardcastle.co.uk/?p=48</guid>
		<description><![CDATA[Once you have finished building a WordPress based website. Wouldn&#8217;t it be great to test it on the live website host, without interrupting any existing files or pages? This is just the kind of scenario that I have been asked &#8230; <a href="http://chrishardcastle.co.uk/wordpress-site-preview">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Once you have finished building a WordPress based website. Wouldn&#8217;t it be great to test it on the live website host, without interrupting any existing files or pages? This is just the kind of scenario that I have been asked about in the past. So, I have recently developed my own suggestion as to how this can be achieved.<br />
<span id="more-48"></span><br />
Once your WordPress database has been set up and all the files for the site are in place. The next step is to replace the existing index.php / html file with the one from the root of your WordPress build. From that moment WordPress with be in control of all incoming requests to your site.</p>
<p>Given that the existing home page has to remain the same until your ready to &#8220;activate&#8221; the new one. You can modify the .htaccess file so the WordPress site will only respond if the homepage has been called with a particular query string. This means you can test the WordPress build without interrupting the main index page. </p>
<p>In order to do this, you have to modify your .htaccess file in the website root. Below is the modified .htaccess file, take a backup before testing!</p>
<p><code><br />
# BEGIN WordPress<br />
RewriteEngine On<br />
RewriteBase /<br />
RewriteCond %{REQUEST_FILENAME} !-f<br />
RewriteCond %{REQUEST_FILENAME} !-d<br />
RewriteCond %{REQUEST_URI} !^/wp-content/<br />
RewriteCond %{REQUEST_URI} !^/wp-includes/<br />
RewriteRule . /$1/?test=true [L]<br />
# END WordPress<br />
</code></p>
<p>Replace your existing .htaccess file with the code above and you are half way. Next modify your index.php in the wordpress site.</p>
<p><code><br />
if(isset($_GET["test"])){<br />
    define('WP_USE_THEMES', true);<br />
    /* Loads the WordPress Environment and Template */<br />
    require('./wp-blog-header.php');<br />
}else{<br />
    /* Your holding page HTML / include file */<br />
}<br />
</code></p>
<p>You can redirect to, or include the existing index page within the else clause as described above. The links should still be intact because the .htaccess file is appending your url with the required query string.</p>
<p>So when you visit the site your existing homepage should remain the same. When you visit http://yoursite.com<strong>/?test=true</strong> your wordpress site should wake up and run accordingly. </p>
]]></content:encoded>
			<wfw:commentRss>http://chrishardcastle.co.uk/wordpress-site-preview/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

