If I understand your intentions correctly, then you have confused the virtualUrl with the destinationUrl. Besides that, your regex for the region parameter is wrong (and you should consider allowing some more characters than just a-z, /test-data/italia/abruzzo2 wont work ie.)
Try this
<add
name="Filter Data Rewrite"
rewriteUrlParameter="ExcludeFromClientQueryString"
ignoreCase="true"
virtualUrl="^\/test-data\/italia\/([a-z]*)$"
destinationUrl="~\/test-data\/italia\/\?region=$1" />
So, the virtualUrl (the one the user types) must start with /test-data/italia/ and end with an infinite amount of letters ranging from a-z. The last part is grouped in paranthesises, so we can reference that in the destinationUrl.
The destinationUrl is then /test-data/italia/?region=[the last part of the virtualUrl].
Umbraco 7 and URLRewriting
Hi, I need to rewrite an URL like this
in a friendlier one like this
I tried some test but I haven't found the correct configuration.
The last (wrong) test has been:
Can anyone help me to write right url rewriting code?
Thank you in advance Adriano
If I understand your intentions correctly, then you have confused the virtualUrl with the destinationUrl. Besides that, your regex for the region parameter is wrong (and you should consider allowing some more characters than just a-z, /test-data/italia/abruzzo2 wont work ie.)
Try this
So, the virtualUrl (the one the user types) must start with /test-data/italia/ and end with an infinite amount of letters ranging from a-z. The last part is grouped in paranthesises, so we can reference that in the destinationUrl.
The destinationUrl is then /test-data/italia/?region=[the last part of the virtualUrl].
OH...I'm sorry, I mistyped. I swapped the virtualurl with the destinationurl. :-)
Thank you Adriano
is working on a reply...