WordPress Permalinks in Windows Using IIRF

November 19, 2009 | By

Ionic’s ISAPI Rewrite Filter is an URL rewriting ISAPI filter for IIS 5.0, 5.1, 6.0 and 7.0. It could be found at http://www.codeplex.com/IIRF. It has a detailed online help file, a long list of examples, and a discussion board that has more than 650 discussions. With the help of this filter we have been able to use WordPress in Windows with Pretty Permalinks enabled for nearly a year now without problems. Below are the contents of the iirf.ini file we use.

Remove the www from the site name

The following lines remove the www from the site name. So if users enter www.codehill.com they will be redirected to http://codehill.com.

RewriteCond %{HTTP_HOST} ^www\.codehill\.com$
RedirectRule ^/(.*)$ http://codehill.com/$1 [R=301]


Excluding a Directory from Rewrite Rules

This line excludes the clients directory from any rewrite rules after it. I needed this because the clients directory has a separete application, and it didn’t need any rewriting.

RewriteRule ^/clients/(.*)$ – [L]



This line makes permalinks work. So far I tried it on 3 WordPress blogs and it worked without any changes.

RewriteRule ^/(?!index.php)(?!wp)([^\.]*)$ /index.php/$1 [I]


The Download Monitor Plugin

Download Monitor is a WordPress plugin for uploading and managing downloads.

RewriteRule ^/sourcecode/(.*)$ /wp-content/plugins/download-monitor/download.php?id=$1 [I]

Filed in: Windows Server, WordPress | Tags: , , , ,

Comments (6)

  1. WP User

    That was helpful, thanks.

  2. David Penrose

    Getting the following error when using this rule:

    CGI Error
    The specified CGI application misbehaved by not returning a complete set of HTTP headers.

    I’m able to view pages under the wp- directories.

    RewriteRule ^/(?!index.php)(?!wp)([^\.]*)$ /index.php/$1 [I]

    If I replace the above with:

    RewriteRule . /index.php [I]

    Public pages are then visible, albeit missing all styling from css. However, then unable to reach pages under wp- directories.

    Iirf.dll v2.0.1.15

    What am I doing wrong?

  3. @David the (?!wp) of the this line skips directories starting wp. Could you try one of the following lines BEFORE it:

    1) if you want www removed from the name:
    RewriteCond %{HTTP_HOST} ^www\.domain\.com$
    RedirectRule ^/(.*)$ http://domain.com/$1 [R=301]

    2) if you want www added to name:
    RewriteCond %{HTTP_HOST} ^domain\.com$
    RedirectRule ^/(.*)$ http://www.domain.com/$1 [R=301]

    And make sure permalinks are enabled.

  4. This has been giving me grief, as have quite a few other things installing WordPress on an IIS6 / Dotnet server.

    This was the last step, to get the permalinks to work right. Thanks!

  5. Your are welcome philtronics. Glad you found the post useful 🙂

  6. Hello, i need some help, maybe you could help me.

    I have IIRF installed on http://biblioteca.koru.cl/ and

    I can enter to

    but it doesn’t work with


    I don’t know nothing about code, what should i add to mi IIRF.ini? Now i have this:

    RewriteEngine ON

    #Change the following to your renamed system folder path:
    RewriteRule ^/wp-content/(.*)$ /wp-content/$1 [I,L]

    #Rewrite wpcontent path (stylesheet, images, admin)
    RewriteRule ^/wp-(.*) /wp-$1 [I,L]

    # do not rewrite requests for stylesheets or image files
    RewriteRule ^/(css|img)/(.*)$ – [L,I]

    #This allows querystring to be added to the url (like {path=logout} )
    RewriteRule /(.*)\?(.*)$ /index.php\?q=$1&$2 [I,L]

    #This removes index.php? from the urls
    RewriteRule ^/(.*)$ /index.php?/$1 [I,L]