I'm using an ISAPI filter for rewriting URL's on IIS (IIRF). The filter process uses C regular expression syntax and a config file to list all the URL rewriting rules.
The config file is simple and works such that each line is a rule, like so:
RewriteRule <regex match expr> <regex replace expr> [flags]
I have many rules working properly now and I need to extend this one explained below just a bit. It's simply a regex matching rule so I thought you all could help.
I have this rule working properly.
the rule below rewrites this url: /artists/999/my-band-name into this url: /artists/artist.aspx?artistid=999&a=my-band-name
RewriteRule ^/artists/(\d+){1}/((?>([^?/\n]|/[^.?/\n])+)(?<!\.aspx))(/?)$ /artists/artist.aspx?artistid=$1&a=$2
Now I need to extend this so that it can take another "folder" at the end, which will denote the page to call. Like so:
/artists/999/my-band-name/shows into: /artists/shows.aspx?artistid=999&a=my-band-name
and
/artists/999/my-band-name/articles into: /artists/articles.aspx?artistid=999&a=my-band-name
I've tried this rule and many variations but it's not working.
RewriteRule ^/artists/(\d+){1}/((?>([^?/\n]|/[^.?/\n])+)(?<!\.aspx))/((shows|goods|fans|articles)+)(/?)$ /artists/$3.aspx?id=$1&a=$2
What would be great is to only capture certain page names in this format (shows|fans|articles) ... I've messed with this a LOT to get it working and I cannot. I think my negative lookbehind for the .aspx might be screwing it up?
Any help or pointers is greatly appreciated!