I’m having difficulties finding clear/concise documentation on setting up ISAPI_Rewrite rules for multiple sites living on one web server. We need each site to have its own httpd.ini file outlining its own rule set. Additionally, each site may be using different versions of the ISAPI_Rewrite module (this must be taken into consideration). We are using IIS 6.0.
Does anyone have any suggestions on how to go about doing this?
Any help would be greatly appreciated!
Thanks,
-Tom
Since you mention httpd.ini, I’m guessing you’re using isapi_rewrite v2. I suggest upgrading to v3 on IIS 6 (For IIS 7 machines, helicon is strongly recommending ‘Ape’ which I have not tried.)
This assumes the paid version of isapi_rewrite v3; the freeware Lite version will not work for this answer.
In v3, the file is named .htaccess instead of httpd.ini
Each website can have its own .htaccess file, with independent rules. Place each file in each website’s root folder.
For different versions of the module, I haven’t tried keeping two versions installed, and am not sure it’s possible. Instead v3 has a RewriteCompatibility2 directive, that you can include or omit in each .htaccess file. This should let you use v2 rules on some websites, while using v3 rules on other sites.
Apparently this makes v3 compatible with v2, but not 100% a syntax match. They provide a translation tool for existing rules. I seem to recall it barely changed anything. The main difference is query string parameter handling – it’s explicit in the v2 rules, but handled separately in v3. (Once fully converted to v3, the rules are much much simpler.)
The above should solve your problems, but there are more complex configurations also:
Subdirectories can also have their own .htaccess files, which are run after the parent file. I’ve done this once to handle pointing a ‘current’ data folder.
There are also directives for VirtualHost, Directory, Location, Files.
Overview here: http://www.helicontech.com/isapi_rewrite/doc/context.htm. I had to read this a few times, so read the individual directives for a slightly clearer explanations.