Apache Rewrite Regex conditionally appending a substring to the replacement? -


hi :) there's no better way explain 1 example.

usual case

i use rewrite rule:

rewriterule ^(.+)(\?.+)?$ index.php?params=$1 [l] 

to like:

# abc.com/home      =>      abc.com/index.php?params=home 

however, discards preexisting parameters, with:

http://localhost/ajax/workouts/getexercisedetails?exerciseid=41 

i get:

params=ajax/workouts/getexercisedetails 

when need:

params=ajax/workouts/getexercisedetails&exerciseid=41 

so... question in english is: there way conditionally append preexisting params (aka string after '?') replacement , still satisfy main use of regex?

if cannot done in same rewrite rule, perhaps using if/then/else?

thanks!

just set qsa flag original query automatically appended new:

rewriterule ^(.+)$ index.php?params=$1 [l,qsa] 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -