<?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>Deserialized &#187; wordpress</title>
	<atom:link href="http://deserialized.com/category/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://deserialized.com</link>
	<description>The Ramblings of a Web Architect</description>
	<lastBuildDate>Mon, 23 Jan 2012 16:33:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>WordPress 2.8 Pretty URLs and IIS6</title>
		<link>http://deserialized.com/iis/wordpress-2-8-pretty-urls-and-iis6/</link>
		<comments>http://deserialized.com/iis/wordpress-2-8-pretty-urls-and-iis6/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 16:10:24 +0000</pubDate>
		<dc:creator>Bryan Migliorisi</dc:creator>
				<category><![CDATA[IIS]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://deserialized.com/?p=8</guid>
		<description><![CDATA[For my first blog post, I thought it would be a good idea to write about the experience and process of setting up WordPress 2.8 on my Windows Server 2003 box with IIS6.  I wanted to enable pretty links (you know, without the ugly index.php prefix), but IIS6 does not support this sort of behavior [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fdeserialized.com%2Fiis%2Fwordpress-2-8-pretty-urls-and-iis6%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fdeserialized.com%2Fiis%2Fwordpress-2-8-pretty-urls-and-iis6%2F&amp;source=Deserialized&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<div class="wp-caption alignleft" style="width: 160px"><a href="http://www.wordpress.org"><img class=" " src="http://www.microsoft.com/web/media/gallery/apps-screenshots/wordpress-250x250.png" alt="WordPress" width="150" height="150" /></a><p class="wp-caption-text">WordPress</p></div>
<p>For my first blog post, I thought it would be a good idea to write about the experience and process of setting up WordPress 2.8 on my Windows Server 2003 box with IIS6.  I wanted to enable pretty links (you know, without the ugly index.php prefix), but IIS6 does not support this sort of behavior out of the box.</p>
<p>Yes, I know - WordPress and PHP belong on Linux but I prefer to think of myself as a Windows developer (C#, ASP.NET), though I work full time developing with PHP, Java\JSP, and JavaScript.</p>
<p>Installing WordPress is pretty straight forward, so I wont bother getting into the easy stuff.  It is just a matter of extracting the files and creating a new web site in the IIS Manager with script execution permissions.  I am going to assume that you already have IIS and PHP running.  If you do not, read up on it at the <a title="IIS6: FastCGI" href="http://forums.iis.net/1103.aspx">IIS6 FastCGI</a> forums on <a href="http://www.iis.net">IIS.net</a>.  You'll find that Windows handles PHP and WordPress just fine, but you'll be missing one major Linux\Apache feature - <a href="http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html">mod_rewrite</a>.</p>
<p>mod_rewrite is the module that allows you to create those fancy "pretty URLs" that everyone loves so much (yes, I love them too).  IIS6 does not support this out of the box so we will need to install an ISAPI filter to accomplish this for us.  My favorite is the open-source <a title="IIRF" href="http://www.codeplex.com/IIRF">Codeplex project IIRF</a>.  I've used it in a number of projects and it always works out well for me.</p>
<p>For the remainder of this post I am going to assume that you already have a working WordPress installation.  On to the fun part...</p>
<p><strong>Installing IIRF in IIS6</strong></p>
<p>Download the latest build of IIRF from Codeplex and extract it to somewhere on your hard drive.  I usually have the following structure:</p>
<pre>C:\inetpub\wwwroot\sitename.com
C:\inetpub\wwwroot\sitename.com\www
C:\inetpub\wwwroot\sitename.com\iirf</pre>
<p>I do this to separate the web content from the ISAPI filter.  When you extract the archive, you'll find there are a ton of files in there.  Most of them are for testing your rules but you only need the following two files:</p>
<pre>IsapiRewrite4.dll
IsapiRewrite4.ini</pre>
<p>The DLL is the actual ISAPI filter and is the equivalent of mod_rewrite on Apache and the INI file is the configuration file which is the equivalent of an .htaccess file on Apache.</p>
<p>Once you have the files extracted in the correct location you must enable the filter in IIS6.  Start by opening up the IIS Manager.  (I'll assume you already know how to do this.)  On the left side, click on the [+] sign to expand the list.  You should see Application Pools, Web Sites, and Web Service Extensions.</p>
<p>Enabling the ISAPI filter is a two step process.  The first step is to add it as a Web Service Extension so click on that list item on the left.  The list of installed ISAPI filters will be shown on the right side.  Click on "<em>Add a new Web service extension" </em>and you'll see the screen below:</p>
<p><img class="alignnone size-full wp-image-13" title="new-web-service-extension" src="http://deserialized.com/wp-content/uploads/2009/08/new-web-service-extension.png" alt="new-web-service-extension" width="398" height="339" /></p>
<p>You may enter any name, but I would recommend that you enter something that identifies this filter so that you can easily remember what it is for.  A good idea is something like  "IIRF for MySite.com"  Once you have chosen a name, you must add the required files.  Click on Add and then click on Browse.  Navigate to the folder that you extracted the IsapiRewrite4.dll file and select it. Press OK.  You should now be looking at the "New Web Service Extension" window again, with one file listed in the "Required files" list.  Check "Set extension status to Allowed" and press OK.</p>
<p>The ISAPI filter is now allowed to run on this web server.  For the second step, you'll need to tell IIS which sites will actually execute this filter.  Expand the "Web Sites" list by pressing the [+] button on the left.  Right click on the web site that you want to enable IIRF for and click Properties.  Select the "ISAPI Filters" tab and click Add.  For filter name you may enter anything you want.  I usually choose "IIRF" but you can enter whatever you want.  Next click on Browse and once again navigate to the same  IsapiRewrite4.dll file that you just selected in Step 1. Press OK to return to the web site properties window.  You should now see the filter listed in the filters list.  Assuming it all went according to plan, press OK again to return to the IIS Manager.</p>
<p>You may need to restart IIS at this point so the server loads the new ISAPI filters.</p>
<p><strong>Setting up IIRF rewrite rules</strong></p>
<p>This is the easy part.  IIRF supports many (but not all) of the same rewrite directives that mod_rewrite does.  It is worth noting that mod_rewrite is incredibly powerful and you can usually find rules for doing all sorts of cool things but they might not always work with IIRF due to lack of support with some mod_rewrite directives.  IIRF is still under development so the future may hold some good news, but your mileage may vary.</p>
<p>IsapiRewrite4.ini must reside in the same folder as IsapiRewrite4.dll.  If it does not exist, create the file now.  To enable pretty URLs for WordPress all we need to do is copy the contents of a valid .htaccess file from a typical Linux\Apache WordPress installation, which I have pasted here:</p>
<pre>RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]</pre>
<p>Save IsapiRewrite4.ini and then head over to your WordPress Administration panel.</p>
<p><strong>Enabling Pretty URLs in WordPress</strong></p>
<p>Log in to your WordPress Administration Panel and click on Settings and then on Permalinks.  Click on "Custom Structure" and enter the following:</p>
<pre>
/%postname%/
</pre>
<p>Now press Save.  At this point, you should be ready to go.  Head over to your blog and refresh it.  Click on some articles and look at the URL.  You should now have pretty, clean URLs.</p>
]]></content:encoded>
			<wfw:commentRss>http://deserialized.com/iis/wordpress-2-8-pretty-urls-and-iis6/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>

