dtsg
dtsg

Reputation: 4468

URL Rewriting combine query string values

I have the following URL rewrite rule:

<ConfigRule>
     <LookFor>/([^/]*)/([^/]*)/([^/]*)/</LookFor>
     <Exclude>/Admin/(.*)</Exclude>
     <SendTo>~/CategoryDetails.aspx?url=$3&amp;fullurl=/$1/$2/$3/&amp;page=1</SendTo>
     <IgnoreQueryStringInMatch>true</IgnoreQueryStringInMatch>
</ConfigRule>

Where $1, $2 and $3 equal a parent group, parent category and category respectively. What i'm trying to do is match a URL for example: /cars/car-parts/wheels/.

The regex does match the url pattern but i have a strange problem where if you have a category with the same name e.g. two with the name name/url "wheels", regardless of whether it's under a different parent/group, you'll be redirected to only one of the two e.g.

/bicycles/bicycle-parts/wheels/

and

/cars/car-parts/wheels/

Will both redirect to the same page.

I believe the culprit is this:

<SendTo>~/CategoryDetails.aspx?url=$3&amp;fullurl=/$1/$2/$3/&amp;page=1</SendTo>

Where ?url=$3 is only matching the last part of the url (wheels), so i guess what i'm asking is is there a way to include the group+parent+category in the url querystring so that it matches all three segments rather than just the end?

Upvotes: 0

Views: 433

Answers (1)

kernel
kernel

Reputation: 154

I suppose what you want is to use fullurl parameter instead of url in the ASP script generating your pages (CategoryDetails.aspx). Full path containing all three hierarchy levels is already passed into the rewritten url, so it's nothing really to do here with an url rewrite.

Upvotes: 1

Related Questions