Compactify the query string
JavaScript (ES6),  103 99 87  86 bytes
Saved 1 byte thanks to @MatthewJensen

s=&gt;Object.values(o=/(\w*=)(\w*)/g,s.replace(o,(s,k,v)=&gt;o[k]=o[k]?o[k]+[,v]:s)).join`&amp;`

Try it online!
Commented
s =&gt;                  // s = query string
  Object.values(      // get the values of ...
    o =               //   ... the object of this regular expression, which is
      /(\w*=)(\w*)/g, //   re-used to store the keys and values of the query
    s.replace(        //   match each key with the '=' sign and the corresponding
      o,              //   value, using the regular expression defined above
      (s, k, v) =&gt;    //   for each matched string s, key k and value v:
        o[k] =        //     update o[k]:
          o[k] ?      //       if it's already defined:
            o[k] +    //         get the current value
            [, v]     //         append a comma, followed by v
          :           //       else:
            s         //         set it to the entire matched string
                      //         (key, '=', first value)
    )                 //   end of replace()
  ).join`&amp;`           // end of Object.values(); join with '&amp;'