<?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>Ryan McDonnell &#187; WordPress</title>
	<atom:link href="http://www.ryanmcdonnell.com/category/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ryanmcdonnell.com</link>
	<description>Pursuing Web Application Zen</description>
	<lastBuildDate>Sun, 05 Jul 2009 18:30:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Multiple blogs, one WordPress install, zero code changes</title>
		<link>http://www.ryanmcdonnell.com/multiple-blogs-one-wordpress-install-zero-code-changes/</link>
		<comments>http://www.ryanmcdonnell.com/multiple-blogs-one-wordpress-install-zero-code-changes/#comments</comments>
		<pubDate>Thu, 12 Jul 2007 13:00:22 +0000</pubDate>
		<dc:creator>Ryan McDonnell</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.ryanmcdonnell.com/multiple-blogs-one-wordpress-install-zero-code-changes/</guid>
		<description><![CDATA[Now I know there are plenty of patches and other projects out there to host multiple blogs from a single installation of WordPress. Many of them focus on trying to host multiple blogs that have a common element such as users, site design, or subdomains. What I wanted to do was a bit different.


One installation of [...]]]></description>
			<content:encoded><![CDATA[<p>Now I know there are <a href="http://codex.wordpress.org/Installing_Multiple_Blogs" target="_blank">plenty of patches and other projects</a> out there to host multiple blogs from a single installation of WordPress. Many of them focus on trying to host multiple blogs that have a common element such as users, site design, or subdomains. What I wanted to do was a bit different.</p>
<p><span id="more-23"></span></p>
<ul>
<li>One installation of WordPress to make future upgrades easy</li>
<li>Run multiple distinct and completely unique sites from that single installation</li>
<li>Each site is configured as its own virtual host within Apache</li>
<li>Each site has a unique design, theme, database, users, etc.</li>
<li>There should be zero changes to the code file included with WordPress.</li>
<li>Future version upgrades should be as easy as uploading the newest files.</li>
<li>Separate &#8216;wp-config.php&#8217; configuration file for each blog/site.</li>
<li>Everything about each blog/site is under one directory that I can provide different users access to via FTP.</li>
</ul>
<h3>Installing Wordpress</h3>
<p>First things first, I downloaded the latest version of WordPress, unzipped it and uploaded it via FTP to my server. I chose to to upload it to &#8220;/var/www/.wordpress&#8221; and gave it the appropriate permissions.</p>
<p>Open &#8216;wp-config.php&#8217; (create it if it doesn&#8217;t exist) and insert the following into it:</p>
<p><code>&lt;?php require('local/wp-config.php'); ?&gt;</code></p>
<p>That&#8217;s it. Your single installation is now ready to serve multiple sites.</p>
<h3>Setup a new blog</h3>
<p>Now comes the fun part. Create the folder you&#8217;ll see running the new blog under. For this example, I&#8217;ll use &#8216;/var/www/example.com&#8217;. This is the folder that will serve as the root folder for the virtual host under Apache.</p>
<p>Under the newly created folder, create an &#8216;.htaccess&#8217; file and insert the following line into it:</p>
<p><code>php_value include_path ".:/var/www/example.com/local/:/var/www/example.com/"</code></p>
<p>Now create a new folder called &#8220;local&#8221;. Within that folder, put the &#8216;wp-config.php&#8217; file that you would normally use with WordPress.</p>
<p><code>&lt;?php<br />
define('DB_NAME', 'wp_example');<br />
define('DB_USER', 'example');<br />
define('DB_PASSWORD', 'password');<br />
define('DB_HOST', 'localhost');<br />
prefix $table_prefix  = 'wp_';<br />
define('WPLANG', '');<br />
define('ABSPATH', '/var/www/example.com/');<br />
require_once(ABSPATH.'wp-settings.php');<br />
?&gt;</code></p>
<p>There is one key change you need to make. Edit the second to last line and define the &#8216;ABSPATH&#8217; variable to be an absolute path to the root of this site.</p>
<p>Now, drop back into the root folder of the site. Create a file called &#8216;wp-config.php&#8217; and put the following line in it:</p>
<p><code>&lt;?php require('local/wp-config.php'); ?&gt;</code></p>
<p>So now your file structure should look like this so far:</p>
<p>/www/var/example.com/.htaccess<br />
/www/var/example.com/wp-config.php<br />
/www/var/example.com/local/wp-config.php</p>
<p>We&#8217;re almost there. Now create symbolic links to all the actual WordPress files/folders except for the &#8216;wp-content&#8217; folder.</p>
<p>index.php -&gt; /var/www/.wordpress/index.php<br />
wp-admin -&gt; /var/www/.wordpress/wp-admin/<br />
wp-atom.php -&gt; /var/www/.wordpress/wp-atom.php<br />
wp-blog-header.php -&gt; /var/www/.wordpress/wp-blog-header.php<br />
wp-comments-post.php -&gt; /var/www/.wordpress/wp-comments-post.php<br />
wp-commentsrss2.php -&gt; /var/www/.wordpress/wp-commentsrss2.php<br />
wp-cron.php -&gt; /var/www/.wordpress/wp-cron.php<br />
wp-feed.php -&gt; /var/www/.wordpress/wp-feed.php<br />
wp-includes -&gt; /var/www/.wordpress/wp-includes/<br />
wp-links-opml.php -&gt; /var/www/.wordpress/wp-links-opml.php<br />
wp-login.php -&gt; /var/www/.wordpress/wp-login.php<br />
wp-mail.php -&gt; /var/www/.wordpress/wp-mail.php<br />
wp-pass.php -&gt; /var/www/.wordpress/wp-pass.php<br />
wp-rdf.php -&gt; /var/www/.wordpress/wp-rdf.php<br />
wp-register.php -&gt; /var/www/.wordpress/wp-register.php<br />
wp-rss.php -&gt; /var/www/.wordpress/wp-rss.php<br />
wp-rss2.php -&gt; /var/www/.wordpress/wp-rss2.php<br />
wp-settings.php -&gt; /var/www/.wordpress/wp-settings.php<br />
wp-trackback.php -&gt; /var/www/.wordpress/wp-trackback.php<br />
xmlrpc.php -&gt; /var/www/.wordpress/xmlrpc.php</p>
<p>I didn&#8217;t want to make symbolic link to the &#8216;wp-content&#8217; folder because I wanted to be able to edit the themes individually for each site. To get that working, create a folder called &#8216;wp-content&#8217; in your site (&#8216;/var/www/example.com/wp-content&#8217;). Under &#8216;wp-content&#8217;, create a &#8216;themes&#8217; folder and then make the following symbolic links:</p>
<p>/var/www/example.com/wp-content/index.php -&gt; /var/www/.wordpress/wp-content/index.php<br />
/var/www/example.com/wp-content/plugins -&gt; /var/www/.wordpress/wp-content/plugins/<br />
/var/www/example.com/wp-content/themes/default -&gt; /var/www/.wordpress/wp-content/themes/default</p>
<p>The last symbolic link will make the default theme available to you until you upload a new one.</p>
<p>Everything is go!</p>
<p>Proceed with your WordPress installation like normal (database setup, login into admin area, etc).</p>
<h3>Plugins</h3>
<p>The &#8216;plugins&#8217; folder has a central location under &#8216;/var/www/.wordpress/wp-content/plugins&#8217;. Upload your plugins there and all your blog can benefit from them. Each blog can enabled to use only the plugins you want to use.</p>
<h3>Future versions</h3>
<p>When future WordPress versions are released, just upload them to the &#8216;.wordpress&#8217; folder and you&#8217;ve updated all your blogs at once! With each new version, take a quick look at the files included incase they&#8217;ve added some new files which you&#8217;ll need to create symbolic links for.</p>
<h3>Caveats</h3>
<p>Unfortunately my method requires some command-like access via a terminal/SSH and this method cannot be used with most shared hosting providers. Perhaps someone can build a small script that builds the symbolic links?</p>
<p>Some directives in the &#8216;.htaccess&#8217; may not work unless you define &#8216;AllowOverrides All&#8217; in the Apache virtual host configuration.</p>
<h3>How it works</h3>
<p>Symbolic links can cause problems when using the include() or require() functions within PHP. The formatting of the requested file&#8217;s path can influence if the file is included from the symbolic link&#8217;s folder or the original folder that the site is running under.</p>
<p>My solution to that problem is contained within the &#8216;.htaccess&#8217; file. The PHP engine is configured to look for include files within a path before it the current folder is checked. This allows us to override the location of the &#8216;wp-config.php&#8217; file and always grab the copy located within the &#8216;local&#8217; folder on each site.</p>
<p>If you have any questions or issues please leave a comment below!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ryanmcdonnell.com/multiple-blogs-one-wordpress-install-zero-code-changes/feed/</wfw:commentRss>
		<slash:comments>71</slash:comments>
		</item>
		<item>
		<title>Stop comment spam on a Wordpress blog</title>
		<link>http://www.ryanmcdonnell.com/stop-comment-spam-on-a-wordpress-blog/</link>
		<comments>http://www.ryanmcdonnell.com/stop-comment-spam-on-a-wordpress-blog/#comments</comments>
		<pubDate>Mon, 19 Mar 2007 23:42:41 +0000</pubDate>
		<dc:creator>Ryan McDonnell</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.ryanmcdonnell.com/stop-comment-spam-on-a-wordpress-blog/</guid>
		<description><![CDATA[I originally posted this in the comments on a recent TechCrunch article, TechCrunch has 15,000 Spam Comments Per Day. I thought it was worth archiving here also.
 This is a method I&#8217;ve used successfully to bring comment spam to screaching halt on some of my clients&#8217; blogs.
First, rename wp-comments-post.php to something else.
Second, create a blank wp-comments-post.php file (just so [...]]]></description>
			<content:encoded><![CDATA[<p>I originally posted this in the comments on a recent TechCrunch article, <font color="#000000"><a href="http://www.techcrunch.com/2007/03/17/techcrunch-has-15000-spam-comments-per-day/trackback/">TechCrunch has 15,000 Spam Comments Per Day</a>.</font> I thought it was worth archiving here also.</p>
<p> This is a method I&#8217;ve used successfully to bring comment spam to screaching halt on some of my clients&#8217; blogs.<span id="more-17"></span></p>
<p>First, rename wp-comments-post.php to something else.</p>
<p>Second, create a blank wp-comments-post.php file (just so that the spammers still get a 200 HTTP status code)</p>
<p>Third, edit the “comments” page in your template. Leave the “action” attribute pointing to the default wp-comments-post.php page. Add some Javascript to the FORM tag’s “onSubmit” method. Something like:</p>
<p><code>onsubmit="this.action='location-of-new-wp-comments-post.php'; return true;"</code></p>
<p>Anyone with Javascript enabled (nearly 100%) will be able to post comments but the spam bots (which do not parse Javascript) will not.</p>
<p>You can even obfuscate the Javascript code further by throwing in some random concatenation…</p>
<p><code>onsubmit="this.action='location' + '-of-new-wp-comments-post.' + 'php'; return true;"</code></p>
<p>… or setting the URL in a variable and referencing the variable instead.</p>
<p> Using this technique brings comment spam to near zero. I&#8217;ve left Akismet in place to catch the small number of manual spam comments but I only see those maybe once every week, even on highly trafficked sites.</p>
<p>Note: I&#8217;ve not implemented this method on this site. This blog gets no comment spam since it gets very low traffic. Someday I&#8217;ll eat my own dog food.</p>
<p><strong>Update 7/11/2007:</strong> The above process works beautifully to stop spam but it&#8217;s a little more complicated than an easier solution that gets 95% of the benefit. The easiest way to stop comment spam is to simply rename the wp-comments-post.php to something else and edit the &lt;form&gt; tag in your theme to reference to the new name. I find it easiest to just throw some random characters at the end of the name. For example, on this site, I&#8217;ve renamed it to &#8220;wp-comments-post-3m0dw12&#215;35.php&#8221;.</p>
<p>The above method using the JavaScript just takes it a step further to combat those bots which actually check the HTML code for the URL the form is posting to.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ryanmcdonnell.com/stop-comment-spam-on-a-wordpress-blog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Redirect /index.php to / with WordPress</title>
		<link>http://www.ryanmcdonnell.com/redirect-indexphp-to-with-wordpress/</link>
		<comments>http://www.ryanmcdonnell.com/redirect-indexphp-to-with-wordpress/#comments</comments>
		<pubDate>Wed, 21 Feb 2007 05:28:24 +0000</pubDate>
		<dc:creator>Ryan McDonnell</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.ryanmcdonnell.com/redirect-indexphp-to-with-wordpress/</guid>
		<description><![CDATA[When evaluting the search engine rankings for some clients with WordPress blogs I noticed that many of the engines were indexing the http://www.domain.com/index.php and http://www.domain.com/ URLs separately. Obviously this is not ideal as it splits up the ranking and authority for that single page into two unique URLs. Having WordPress in the mix complicates the [...]]]></description>
			<content:encoded><![CDATA[<p>When evaluting the search engine rankings for some clients with WordPress blogs I noticed that many of the engines were indexing the http://www.domain.com/index.php and http://www.domain.com/ URLs separately. Obviously this is not ideal as it splits up the ranking and authority for that single page into two unique URLs. <span id="more-11"></span>Having WordPress in the mix complicates the solution because it already adds mod_rewrite rules to the .htaccess file to handle the permalinks for your blog. Here&#8217;s the trick to make it work:<br />
<code><br />
RewriteEngine On<br />
RewriteCond %{THE_REQUEST} ^[^/]*/index\.php [NC]<br />
RewriteRule . / [R=301,L]<br />
</code><br />
Add the above rules <strong>before</strong> the WordPress mod_rewrite rules. The trick here is that the rule matches the actual URL specified in the HTTP request. If you try using a rule that matches REQUEST_URI (or similar) you&#8217;ll get an infinitely looping redirect because it conflicts with the WordPress rules.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ryanmcdonnell.com/redirect-indexphp-to-with-wordpress/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
