Forum Moderators: phranque
I'd like to dynamic rewrite a given url. example: /filename/p1=v1/p2=v2/.../p20=v20 (p=parameter, v=value)
mod_rewrite shall rewrite it to
filename.php?p1=v1&p2=v2...&p20=v20
But I don't know how many parameters there are. It may be 20 but could also be 2 or 100. So how can I create a 'dynamic' pattern matching and replacing for mod_rewrite?
hope you understand and can help!
cheers,
arthur :)
Jim
Yes, you could do that by making the rewriterule recursive, but that is terribly inefficient.
If you want to try it anyway, see the [N] flag of RewriteRule, and heed the warnings about code position. You'll also need the [QSA] flag to retain query parameters created by previous rewrite passes.
[added]I was not referring to creating a separate script to be called by RewriteMap; I was suggesting that you rewrite all (appropriate) URL requests to your existing script(s), and then have that/those scripts get the parameters out of the originally-requested 'static' URL by accessing the server variable containing that requested URL. [/added]
Jim