htaccess mod Rewrite Rule – optional parameters

I want to rewrite the below:

  1. http://www.mywebsite/address/12345/ to http://www.mywebsite/address/?param1=12345
  2. http://www.mywebsite/address/12345/12 to http://www.mywebsite/address/?param1=12345&param2=12
  3. http://www.mywebsite/address/12345/?{otherparam}=1 to http://www.mywebsite/address/?param1=12345&{otherparam}=1

Below is what I have in the .htaccess file. I have the first two working fine yet am struggling with the 3rd. I need the third to pass param1 & moreover pass other optional parameters. Can anyone assist?

You’re looking for the QSA flag, which appends any existing query string to the newly constructed one in the rule’s target: