Month: November 2010

How can I get Pretty Permalinks on a Windows web server?

If you happen to be hosting your WordPress blog on a Windows server, you may have run into the issue of trying to remove the index.php section from your URLs. I was just about to attempt writing an HttpHandler to perform the rewrites when I stumbled upon the following article.

http://learn.iis.net/page.aspx/466/enabling-pretty-permalinks-in-wordpress/

It just so happens that if you’re host is running IIS 7.0, removing those URLs is relatively simple using the built-in URL Rewrite functionality of IIS. The linked article provides a very nice summary of the steps you’ll need to take, but  it basically amounts to adding the following <rewrite> section to the <system.webServer> element of your site’s web.config file.

<rewrite>
  <rules>
    <rule name="Main Rule" stopProcessing="true">
      <match url=".*" />
      <conditions logicalGrouping="MatchAll">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
      </conditions>
      <action type="Rewrite" url="index.php" />
    </rule>
  </rules>
</rewrite>

Since it took some time for me to locate the article in a Google search, I thought I’d post a link here to help document the solution.