tags:

views:

339

answers:

1

I'm struggling to get some code working for an old ASP store site I manage - I have added the following which works perfectly well

RewriteBase /
RewriteRule ^cat/[^?/]*_(\d+)\.htm /store/prodList.asp?idcategory=$1 [QSA]

Problem is if the category page has more than one page! As it adds another couple of parameters to the querystring like so

/store/prodList.asp?idcategory=102&curPage=2&sortField=sortorder

I'm looking for an example of taking three more querystring parameters and appending it to the rewritten URL... Can anyone help please?

So for example, currently the following URL works fine

cat/productname_5.htm ... equates to ... /store/prodList.asp?idcategory=5

I need to do something like the following when I have more than one page? but don't know the ISAPI syntax?

cat/productname_5_2_sortorder.htm ... would equate to ... /store/prodList.asp?idcategory=5&curPage=2&sortField=sortorder

I hope that makes more sense?

A: 

I think this is what you are asking, set the [L] argument to make it stop matching on first match. ?

But [L] requires you to order them by most restrictive first, 4 args, then 3, 2 etc...

  ReWriteRule ^/store/([0-9]+)/([0-9]+)/{0,1}$ /store/prodList.asp\?idcategory=$1&curPage=$2 [L]

  ReWriteRule ^/store/([0-9]+)/([0-9]+)/([A-Za-z]+)/{0,1}$ /store/prodList.asp\?idcategory=$1&curPage=$2&sortField=$3 [L]
Chad Grant
Thanks for replying - I have amended my question slightly as I don't think I explained myself very well - Please let me know if you could help with it?
leen3o
my examples are a different , but same concept applies. try it out using the [L] 's and in order of 5 query string parameters, 4, 3 etc,,,
Chad Grant
Ok thanks I'll have a play with it
leen3o
Awesome got it working based on your example above... VERY appreciated
leen3o