URL rewrite using regular expressions to create default document for htaccess and IIRF
Posted on 2014-09-26
I'm using Ionic Isapi Rewrite Filter to do URL rewriting for IIS 6.0. It uses syntax that should be nearly identical to htaccess. I have these two rules in place:
RewriteRule ^([^\.]+)$ $1.htm [NC,L]
RewriteRule ^([^\.]+)$ $1.asp [NC,L]
The take whatever the string after the domain is (i.e., http://www.mydomain.com/testurl) and convert it to a document, in this case http://www.mydomain.com/testurl.htm
However, these rules don't work for http://www.mydomain.com or http://www.mydomain.com/
In those cases, I need it to go to default.htm.
In htaccess, I use this:
...however, DirectoryIndex doesn't seem to be valid in IIRF syntax. This is what I've come up with so far:
RewriteRule ^?$ /default.htm
However, that doesn't work. This is difficult to debug, there is an error log but its hard to see what is going on "under the hood." Would appreciate any advice.