Setting up ISAPI Rewrite on IIS 6

If you’ve worked with IIS6, you can attest to the pain you can go through when setting up “Clean URL” functionality. This post applies to an installation of Drupal 7 on IIS 6.

I tried to install Ionic’s ISAPI Rewrite and Helicon’s ISAPI Rewrite 2 with no success. My requirements were not to pay for this functionality and to install this functionality only in a single virtual directory under my main website.

I was able to get my site working using the version 3 of Helicon’s ISAPI Rewrite.

Because this verison (free Lite version) of the ISAPI Rewrite has some limitations with the .htaccess file, I needed some conditions to apply the rules to my main site and exclude the rules from a sibling Joomla installed site.

Here’s my final .htaccess file:

# Helicon ISAPI_Rewrite configuration file
# Version
RewriteEngine on
RewriteCond %{URL} ^(?!/excludesite)
RewriteCond %{URL} ^(?!/excludesite/.*$)
RewriteBase /mainsite/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

Hopefully this will save sometime for someone out there. I certainly wish I had seen this somewhere. 🙂

Leave a Reply