I previously replied to the most recent posts from lucy24 and g1smd, but I don't see that my post got properly submitted to this page. In short, I commented that I agreed that the %1 in the second RewriteRule was wrong.
I also posted a quote from the apache documentation saying that the protocol and host defaulted to the current, and was wondering if in spite of this it is a better practice to include them, or something else. From page [httpd.apache.org...]
Use of the [R] flag causes a HTTP redirect to be issued to the browser. If a fully-qualified URL is specified (that is, including [servername...] then a redirect will be issued to that location. Otherwise, the current protocol, servername, and port number will be used to generate the URL sent with the redirect.
g1smd: Thanks for the additional insight into the regex fine points. Fortunately, all of the query string parameters occur in a fixed order, and in addition they work as flags. That is, the name=value as a whole is the flag; value never varies. So my simpler regex could work. Nevertheless, I believe it is wise to make the regex more robust, so as not to restrict the assumptions to the current rules of the implementation.