1

My regex expression for isapi rewrite here isn't passing variables in the URL

Trying to pass a variables like: www.domain.com/z34232/ProductName.html?ref=magic

But the code is ignoring the "ref=magic" string

  RewriteRule .*z([[:digit:]]*)\/.*.html\??(.*)  /product.asp\?pnum=$1(?2&$2&:) [I,O,L]

Any suggestions would be extremely helpful. I need to keep the rest of the string intact.

1
  • Is the result supposed to be: "www.domain.com/product.asp?pnum=34232&ref=magic&:"?
    – Dingo
    Oct 20, 2010 at 22:37

2 Answers 2

0

I think you trying to achieve something like this:

RewriteRule .*z([0-9]*)/.*\.html(\?.*)? /product.asp?pnum=$1$2 [QSA]
2
  • Doesn't seem to pass the URL param
    – joe
    Oct 21, 2010 at 0:01
  • With QSA param it does. QSA practically means, that Apache would add query string part by its own
    – Andrew
    Nov 5, 2010 at 14:09
0

You can't use the pattern to match the query string. Something similar to the following should work:

RewriteRule .*/z([[:digit:]]*)/.*\.html  /product.asp?pnum=$1&%{QUERY_STRING}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.