url rewrite regex - root files only
I am using url rewriting rules in my web.config and have it working but today I added a rule in a folder but my primary rule keeps overriding.
Web.config
Code:
<rewriter>
<rewrite url="~/folder/*_a_(.+).aspx" to="~/folder/index.aspx?id=$1" />
<rewrite url="~/*_a_(.+).aspx" to="~/listing.aspx?id=$1"/>
</rewriter>
Usage:
www.domain.com/topic_a_1.aspx -> This would load listing.aspx?id=1 which is great.
www.domain.com/folder/newtopc_a_2.aspx -> This is also loading listing.aspx?id=2 but should be loading index.aspx?id=2
I believe I need to change the second rule from *_a_... to something like [^\/]_a_.... but that doesn't work.
Anyone know what I can do so the second rule doesn't override my sub folder rules?
Thanks.
Re: url rewrite regex - root files only
Hello,
Just to confirm, if you remove this rule:
Code:
<rewrite url="~/*_a_(.+).aspx" to="~/listing.aspx?id=$1"/>
Does the other rule work as expected?
Gary
Re: url rewrite regex - root files only
Good question. I will have to test it out after hours or on development site since it's the live rewriter.