I'm working on a multilingual application that uses IIS7-based url rewriting.
I'd like the following Url actions:
1. fr-ca > index.aspx?l=&lc=fr-ca
2. fr-ca/ > index.aspx?l=&lc=fr-ca
3. fr-ca/568/sometitle > index.aspx?l=568&lc=fr-ca
4. 568/sometitle > > index.aspx?l=568&lc=
Essentially, the initial fr-ca is optional.
My current rule:
<match url="^(fr-ca.)?([^/][0-9]+)?/*" />
Fails on #1
Another attempt:
<match url="^(fr-ca)?(.[0-9]+)?/*" />
Passes all requirements, except the back reference {R:2} gives /568 in this case.
I suppose I could add another rule that adds a / to the end of a fr-ca only, but that doesn't seem right.
Thanks for any help! Regex drives me bonkers.