Rules when in a virtual directory

Topics: User Forum
Sep 14, 2009 at 1:02 PM

Hi,

I am working on a site that has the ability to be both a root application and inside a virtual directory. I have rules like:-

RewriteRule /Posts/(.*)/January/$ /Posts.aspx?year=$1&part=1 [I]

These of course work for the root but don't even seem to be picked up by the virtual directory. I therefore tried:-

RewriteRule (.*)/Posts/(.*)/January/$ (.*)/Posts.aspx?year=$2&part=1 [I]

Which broke both.

Can someone please point me in the right direction.

Thanks.

Coordinator
Sep 14, 2009 at 6:22 PM

Rules are made of regular expressions, and then replacement strings and options.  The order of the rules also matters.  If you're having trouble with the regex, You can try some nice free Regex tools, like Expresso, RegexDesigner from Rad Softwware, or Gerry Shaw's tool, to get the basic regex developed. But you have to remember that different regex engines work differently and as far as I know these engines all use .NET, which is different from the PCRE used by IIRF.  This matters only when you use advanced features in PCRE that are not supported by .NET, or vice versa.

After you get the regex you need, there's a really handy tool included with IIRF called the TestDriver, that helps you debug your rules to make sure they work for all the URLs you expect.

Sep 15, 2009 at 6:45 AM

Hi Cheeso,

Actually I think my problem is that the ISAPI fiter isn't working when used on a Virtual Directory. The logs are showing nothing. That's where I'm looking for help.

 

Regards,
CFe 

Sep 15, 2009 at 7:01 AM

Never mind! Fresh head.

I thought the fact that the virtual directory pointed to the application with the ISAPI Filter was enough. It's not. It has to be applied to the site containing the virual directory as well.