Can this .htaccess be translated to an IsapiRewrite4.ini ?

Topics: Developer Forum
Dec 11, 2008 at 10:03 PM
I'm new to this whole concept of URL rewriting (and Regular Expressions) so a lot of this is over my head. But from what I'm reading, it SHOULD be possible to translate this .htaccess mod_rewrite rules into an IsapiRewrite4.ini file.
This is for the up-and-coming open source CMS SilverStripe. The developers are all apparently unix guys and so their installer writes the .htaccess file for the root CMS folder automatically. But if you are running IIS (especially older IIS like 5.0) you are at a loss. The IIRF looks like the BEST way to do this, but I need some help translating the following into IIRF language.

Here are the full contents of the .htaccess files that the SilverStripe installer (v 2.3.0rc2) writes:

RewriteEngine On
RewriteBase /intranet

RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$

RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]

Can anyone help?
If I can get this to work, the SilverStripeRules.ini could be helpful to other SilverStripe/IIS users if packaged with the download (like DrupalRules.ini is).
Thanks for any help that anyone can provide!

Nov 9, 2009 at 8:47 PM

Hey Darren. Check out


Nov 9, 2009 at 9:55 PM

It should just work, if you use the latest v2.0 product (v2.0.1.1008 or later).

For a long time the syntax where you negate the RewriteCond with a leading ! was not supported in IIRF.  you had to use a (?!pattern), which was a pain.

As of IIRF v2.0.1.1008, the leading ! in a pattern on a RewriteCond is treated as negation.   The rest of that file is fully compatible with IIRF.

So... use v2.0 (latest) and you should be good to go.