Multiple matches

Topics: User Forum
Sep 21, 2009 at 9:33 AM


I've been through the documentation a few times and can't seem to find any answer to my quesstion so hopefully someone here can help?

If I have these two redirect rules:

RedirectRule ^/test [I,R=301]
RedirectRule ^/testing [I,R=301]

Then when I type, it redirects to /test.aspx because it is matching the first rule.  Is there anyway to make the url-pattern be an exact match?

Thanks for your help!



Sep 21, 2009 at 9:14 PM

yes.  The $ in a regex implies "end of string" so often you will see patterns brakcted by ^ (beginning of string) at the beginning, and $ at the end.

in your case it would be

RedirectRule ^/test$ [I,R=301]
RedirectRule ^/testing$ [I,R=301]

you could wildcard it with something like this:

RedirectRule ^/(test|testing)$$1.aspx [I,R=301]
Sep 22, 2009 at 3:20 PM

Fantastic! Thanks so much for your help.