Mutilating the Query
GNU sed 98 96 88 80 77 74 69 59 54 (48 + 1 for -r) 49

:;s,(.+)(=[^&amp;]*[&amp; ]|&amp;)(.*)\1,\3 ,
t;s,[?&amp;]? .*,,


The list of parameters to remove are separated by spaces.  

$ echo 'http://example.com/?foo=1&amp;bar=2&amp;baz=3 foo bar baz' | sed -rf sed.txt
http://example.com/

$ echo 'http://example.com/?foo&amp;bar=2&amp;baz= foo baz' | sed -rf sed.txt
http://example.com/?bar=2

$ echo 'http://example.com/' | sed -rf sed.txt
http://example.com/