WordPress Permalinks on IIS with ISAPI_Rewrite

I’ve run WordPress here on my CentOS box for nearly 4 years and am quite familiar with the software. Recently, I had a client on a Windows system request a blog be added to their web store. Their webstore is written in ASP and runs on windows. They wanted to stay on the same domain for SEO purposes, (thus site.com/blog/ instead of blog.site.com or a new .com). Without the subdomain or new IP, there’s no way to change DNS for a subdirectory to a different server. This meant I had to get it working on IIS.

Native installations for apache tend not to port well (or perhaps, easily) over to windows/IIS. Thankfully, ISAPI3 from HeliconTech.com supports .htaccess files and makes the job a little easier. WordPress works fine on windows/IIS until you want nice permalinks.

After MUCH searching, testing, and error log analysis, I’ve got a working solution for Windows Server 2003 with ISAPI_Rewrite 3.1.x, running php 5.2.x and mysql 5.0.x community.

  1. index.php should be set up in IIS as a default document (same place you find default.asp, index.htm, etc)
  2. edit wp-settings.php

    at the very top of the file.

    Replace with:

  3. create the following htaccess file with the Helicon Manager:

    RewriteEngine On

    #RewriteBase /

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule . - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . /blog/index.php [L]

    • Note: You may need to alter the RewriteBase or the last rule to your specific location. In my particular case, I was installed on domain.com/blog/

From here, you can edit your permalink structure as you normally would. If the default options has index.php/ as part of the rule, you can remove that.


  1. I’m still having a little trouble getting this to work. Do you know where I can go to get more WordPress info on how to set up all of the tricks on my website? I’m looking for something a little more basic where it can walk me through more of a copy and paste option…

  2. Thanks for the tool but I’m a newbie and still having a difficult time getting it to work. I need to change DNS for a subdirectory to a different server. Any suggestions?

  3. I’m still new to WordPress and this helps alot. This will go directly into my saved documents for future reference. Thanks again for the coding.

  4. This was very helpful—especially when this post was originally written. It’s actually a lot easier now. I’m currently using Windows 2008 server, but I’m actually considering switching to Linux. I’m a huge advocate of WordPress, and the latest version of Drupal is pretty good too.

Leave a comment

Your email address will not be published. Required fields are marked *