Reputation: 11
I have a question concerning urlrewiter. I want to rewrite the following url like this:
<rewrite url="~/sportswear/browse-by-category/(\d+)/(.+)/(\d+)" to="~/Browse.aspx?cid=9&type=category&mid=$1&p=$2" />
This does work but my get variable p cannot be read. However when i write 'shoes' which is the categoryname instead of (.+) it works perfectly. Does anyone know what seems to be the problem?
Thanks for your time.
Kind regards, Mark
Upvotes: 1
Views: 163
Reputation: 4261
Actually, you should start learning to make your groups non capture:
<rewrite url="~/sportswear/browse-by-category/(\d+)/(?:.+)/(\d+)" to="~/Browse.aspx?cid=9&type=category&mid=$1&p=$2" />
Basically, just use (?:) instead of () if you don't want to capture it. Additionally, there was no need to group that .+, no?
<rewrite url="~/sportswear/browse-by-category/(\d+)/.+/(\d+)" to="~/Browse.aspx?cid=9&type=category&mid=$1&p=$2" />
Upvotes: 1
Reputation: 11
Oooow sorry guys, i figured it out already, i had to replace $2 with $3 since that was the regex array number. Thanks anyways! :)
Upvotes: 0