Hi,
Now 2 years later I move my systems from Apache on Windows to IIS7 on Windows Web Server 2008 and use Helicon's software to do Mod_Rewrite the Apache way.
I changed my folder logic and outlay slightly to adjust for IIS7. The outlay I'm using is on
http://www.infoveld.com/folder_outlay.htm
Also each folder per domain may have it's own folder (Intraweb) for dynamic systems and it's own set of folders for sub domains (starting with a underscore).
Summary of my setup:
The root folder of IIS7 is C:\inetpub\wwwroot
In this folder I want to use a main .htaccess file with the only purpose to route requests to the appropriate sub folders. These sub folder names are exactly the same as their corresponding domain names. In these folders I again want to use a .htaccess file. The purpose of this file is firstly to test whether it is a request for a dynamic system and, if true, do the required URL re-writing. If the request is not for a dynamic system, route it to the appropriate sub folder of the sub domain. The names of the sub folder always start with a underscore.
The .htaccess code I'm using under Apache follows:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?(geosites|geoinfo|sageolit|geositesupdate)\.nolsmit\.com$ [NC]
RewriteRule ^(.*)$
http://www.nolsmit.com/%2/$1 [R=301,L]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+\.[^\.]+)$ [NC]
RewriteRule !^(geosites|geoinfo|sageolit|geositesupdate).*$ /%2%{REQUEST_URI} [QSA,L]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.([^\.]+\.[^\.]+)$ [NC]
RewriteRule !^(geosites|geoinfo|sageolit|geositesupdate).*$ /%3/_%2%{REQUEST_URI} [QSA,L]
RewriteRule ^(.*)report([0-9]+)-site([0-9]+)$ $1?report_id=$2&site_id=$3 [QSA,L]
RewriteRule ^(.*)report([0-9]+)-country([0-9]+)$ $1?report_id=$2&country_id=$3 [QSA,L]
RewriteRule ^(.*)report([0-9]+)-country([0-9]+)-province([0-9]+)$ $1?report_id=$2&country_id=$3&province_id=$4 [QSA,L]
Specific examples of requested and resulting urls I want for IIS7:
My <ServerRoot> is the default: C:\inetpub\wwwroot
Static web pages:
http://www.infoveld.com ==> <ServerRoot>\infoveld.com\index.html
http://pat.infoveld.com ==> <ServerRoot>\infoveld.com\_pat\index.html
http://piet.infoveld.com ==> <ServerRoot>\infoveld.com\_piet\index.html
http://christa.infoveld.com ==> <ServerRoot>\infoveld.com\_christa\index.html
http://www.nolsmit.com ==> <ServerRoot>\nolsmit.com\index.html
http://pat.nolsmit.com ==> <ServerRoot>\nolsmit.com\_pat\index.html
http://piet.nolsmit.com ==> <ServerRoot>\nolsmit.com\_piet\index.html
Dynamic web applications:
My compiled ISAPI dlls are in folder <ServerRoot>\<domain name>\IntraWeb and they are restricted to (for temporary files) a folder <ServerRoot>\<domain name>\IntraWeb\Files and sub-folders below ..\Files
http://sarnap.infoveld.com ==>
http://www.infoveld.com/infoveld.com/in ... sarnap.dll
http://geosites.infoveld.com ==>
http://www.infoveld.com/infoveld.com/geosites.dll
http://sarnap.nolsmit.com or
http://www.nolsmit.com/sarnap ==>
http://www.nolsmit.com/nolsmit.com/intraweb/sarnap.dll
http://geosites.nolsmit.com or
http://www.nolsmit.com/geosites ==>
http://www.nolsmit.com/nolsmit.com/intr ... osites.dll
and using parameters:
... for infoveld.com domain:
http://geosites.infoveld.com/report0/site32 or
http://www.infoveld.com/geosites/report0/site32
==>
http://www.infoveld.com/infoveld.com/in ... site_id=32
http://geosites.infoveld.com/report0/country2 or
http://www.infoveld.com/geosites/report0/country2
==>
http://www.infoveld.com/infoveld.com/in ... untry_id=2
http://geosites.infoveld.com/report0/country1/province1 or
http://www.infoveld.com/geosites/report ... /province1
==>
http://www.infoveld.com/infoveld.com/in ... vince_ID=1
... for nolsmit.com domain:
http://geosites.nolsmit.com/report0/site32 or
http://www.nolsmit.com/geosites/report0/site32
==>
http://www.nolsmit.com/nolsmit.com/intr ... site_id=32
http://geosites.nolsmit.com/report0/country2 or
http://www.nolsmit.com/geosites/report0/country2
==>
http://www.nolsmit.com/nolsmit.com/intr ... untry_id=2
http://geosites.nolsmit.com/report0/country1/province1 or
http://www.nolsmit.com/geosites/report0 ... /province1
==>
http://www.nolsmit.com/nolsmit.com/intr ... vince_ID=1
Regards,
Nols Smit