<?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>Richard Shepherd &#187; iis</title>
	<atom:link href="http://www.richardshepherd.com/tag/iis/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.richardshepherd.com</link>
	<description>Making the web. Better looking.</description>
	<lastBuildDate>Fri, 04 Jun 2010 18:03:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>WordPress, IIS, Permalinks and index.php</title>
		<link>http://www.richardshepherd.com/wordpress-iis-permalinks-and-index-php/</link>
		<comments>http://www.richardshepherd.com/wordpress-iis-permalinks-and-index-php/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 18:12:35 +0000</pubDate>
		<dc:creator>richardshepherd</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[iis]]></category>
		<category><![CDATA[index.php]]></category>
		<category><![CDATA[isapi]]></category>
		<category><![CDATA[permalinks]]></category>

		<guid isPermaLink="false">http://www.richardshepherd.com/?p=592</guid>
		<description><![CDATA[Here&#8217;s the problem: You need to install WordPress on a Windows machine running IIS. I&#8217;d never normally do this, but sometimes you just don&#8217;t have a choice. There are plenty of links out there about how to do this, and the one I referred to most was How To Install WordPress on IIS 6.0. It [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s the problem:</p>
<p>You need to install WordPress on a Windows machine running IIS. I&#8217;d never normally do this, but sometimes you just don&#8217;t have a choice.</p>
<p>There are plenty of links out there about how to do this, and the one I referred to most was <a href="http://www.iisadmin.co.uk/?p=6" target="_blank">How To Install WordPress on IIS 6.0</a>. It is, more or less, straightforward.</p>
<p>However, there&#8217;s an issue with IIS and permalinks.<span id="more-592"></span>The issue is that if you want to take advantage of the WordPress pretty permalinks, you have to suffer a folder in the path called &#8216;index.php&#8217;. So, instead of the rather lovely:</p>
<p><strong>http://www.yourblog.com/yourcategories/the-best-post-in-the-world/</strong></p>
<p>you have to grit your teeth and accept:</p>
<p><strong>http://www.yourblog.com/index.php/yourcategories/the-best-post-in-the-world/</strong></p>
<p>I don&#8217;t know why, I really don&#8217;t. I&#8217;m not that smart. But I did work out how to fix it. It&#8217;s easy enough, but you have to put a couple of rules in the ISAPI ReWrite Engine to deal with the quirks.</p>
<p>First we need to head into our WordPress admin tool, and go to Settings &gt; Permalinks. There, you&#8217;ll see the craft insertion of /index.php/ in the links. We need to create a custom permalink and <em>delete</em> the index.php bit. Just like this&#8230;</p>
<p><img class="alignnone size-full wp-image-598" title="WordPress Permalink Options" src="http://s85883.gridserver.com/wpblog/wp-content/uploads/2009/07/links1.jpg" alt="WordPress Permalink Options" width="504" height="373" /></p>
<p>Now save that off and head over to your .htaccess file &#8211; we need to weave some magic!</p>
<p>At the bottom of this post is the whole file, but the two lines I particularly want to point out are:</p>
<div class="codecolorer-container c default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="c codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">RewriteCond <span style="color: #339933;">%</span><span style="color: #009900;">&#123;</span>REQUEST_URI<span style="color: #009900;">&#125;</span> <span style="color: #339933;">!/</span>wp<span style="color: #339933;">-</span>admin<br />
RewriteRule <span style="color: #339933;">^/</span><span style="color: #009900;">&#40;</span>.<span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span>$ <span style="color: #339933;">/</span>index\.<span style="color: #202020;">php</span><span style="color: #339933;">/</span>$<span style="color: #0000dd;">1</span> <span style="color: #009900;">&#91;</span>NC<span style="color: #009900;">&#93;</span></div></td></tr></tbody></table></div>
<p>The second line works the juju. It takes the URL from the browser, shoves an /index.php/ into it, and displays the contents. For more on how and why this works, check out <a href="http://www.workingwith.me.uk/articles/scripting/mod_rewrite" target="_blank">http://www.workingwith.me.uk/articles/scripting/mod_rewrite</a> for the basics.</p>
<p>Now the first line is <em>really</em> important, because it tells the server <strong>not</strong> to do this if we&#8217;re in the admin section. If we remove this line, there are all kinds of problems reaching /wp-admin/index.php. Trust me.</p>
<p>I have two other lines in the following code which get rid of index.php from URLS, which stops the google duplicate content issue. They&#8217;re always worth having.</p>
<p>Finally, make sure that wherever your site is hosted, that the correct permissions are set on the wp-admin and wp-content directories and their sub-directories. You must have read/write/modify permissions set for internal user accounts.</p>
<p>If you implement these small tweaks, then your WordPress IIS install should work like a charm.</p>
<p>Good luck!</p>
<p>Here&#8217;s the code:</p>
<div class="codecolorer-container c default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br /></div></td><td><div class="c codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339933;"># -------------------------------------------------------------------------</span><br />
<span style="color: #339933;"># Kickstart the Rewrite Engine and set initial options</span><br />
<span style="color: #339933;"># -------------------------------------------------------------------------</span><br />
<br />
RewriteEngine On<br />
RewriteCompatibility2 On<br />
RepeatLimit <span style="color: #0000dd;">200</span><br />
RewriteBase<br />
<br />
<span style="color: #339933;"># -------------------------------------------------------------------------</span><br />
<span style="color: #339933;"># WORDPRESS, WINDOWS &amp; ISAPI DOCUMENTATION</span><br />
<span style="color: #339933;"># -------------------------------------------------------------------------</span><br />
<span style="color: #339933;"># These are the WordPress redirects we need in place for a Windows Server</span><br />
<span style="color: #339933;"># running PHP &amp; MySQL</span><br />
<span style="color: #339933;"># We had some issues configuring ISAPI with WordPress and so here are the</span><br />
<span style="color: #339933;"># solutions in case we need them again!!</span><br />
<br />
<span style="color: #339933;"># -------------------------------------------------------------------------</span><br />
<span style="color: #339933;"># PERMISSIONS SETTINGS</span><br />
<span style="color: #339933;"># -------------------------------------------------------------------------</span><br />
<span style="color: #339933;"># The following folders:</span><br />
<span style="color: #339933;"># wp-admin</span><br />
<span style="color: #339933;"># wp-content</span><br />
<span style="color: #339933;"># MUST HAVE read/write/modify permissions set for internal user accounts</span><br />
<br />
<span style="color: #339933;"># -------------------------------------------------------------------------</span><br />
<span style="color: #339933;"># ESSENTIAL WORDPRESS REWRITES</span><br />
<span style="color: #339933;"># -------------------------------------------------------------------------</span><br />
<br />
<span style="color: #339933;"># Redirects 'www.yourblogsite.com/index.php' to 'www.yourblogsite.com/'</span><br />
<br />
RewriteRule <span style="color: #339933;">^/</span>index\.<span style="color: #202020;">php</span>$ <span style="color: #339933;">/</span> <span style="color: #009900;">&#91;</span>NC<span style="color: #339933;">,</span>P<span style="color: #339933;">,</span>R<span style="color: #339933;">=</span><span style="color: #0000dd;">301</span><span style="color: #009900;">&#93;</span><br />
<br />
<span style="color: #339933;"># Rewrite 'www.yourblogsite.com/anything/' to 'www.yourblogsite.com/index.php/anything/'</span><br />
<span style="color: #339933;"># NB. The user does not see this rewrite.</span><br />
<span style="color: #339933;"># Must also go into WordPress &gt; Settings &gt; Permalinks and select 'custom'</span><br />
<span style="color: #339933;"># and then REMOVE 'index.php' from the custom URL it generates</span><br />
<br />
<span style="color: #339933;"># The first line is a condition so it doesn't apply the rule to the wp-admin part of the site</span><br />
<br />
RewriteCond <span style="color: #339933;">%</span><span style="color: #009900;">&#123;</span>REQUEST_URI<span style="color: #009900;">&#125;</span> <span style="color: #339933;">!/</span>wp<span style="color: #339933;">-</span>admin<br />
RewriteRule <span style="color: #339933;">^/</span><span style="color: #009900;">&#40;</span>.<span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span>$ <span style="color: #339933;">/</span>index\.<span style="color: #202020;">php</span><span style="color: #339933;">/</span>$<span style="color: #0000dd;">1</span> <span style="color: #009900;">&#91;</span>NC<span style="color: #009900;">&#93;</span><br />
<br />
<span style="color: #339933;"># Finally, redirect 'www.yourblogsite.com/anything/anything/index.php'</span><br />
<span style="color: #339933;"># to 'www.yourblogsite.com/anything/anything/'</span><br />
<br />
RewriteRule <span style="color: #339933;">^/</span><span style="color: #009900;">&#40;</span>.<span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span>index\.<span style="color: #202020;">php</span>$ <span style="color: #339933;">/</span>$<span style="color: #0000dd;">1</span><span style="color: #339933;">/</span> <span style="color: #009900;">&#91;</span>NC<span style="color: #339933;">,</span>P<span style="color: #339933;">,</span>R<span style="color: #339933;">=</span><span style="color: #0000dd;">301</span><span style="color: #009900;">&#93;</span><br />
<br />
<span style="color: #339933;"># -------------------------------------------------------------------------</span><br />
<span style="color: #339933;"># END OF ESSENTIAL REWRITES</span><br />
<span style="color: #339933;"># -------------------------------------------------------------------------</span></div></td></tr></tbody></table></div>
<p>Thanks for watching, kids&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.richardshepherd.com/wordpress-iis-permalinks-and-index-php/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
