I have a similar problem and also lack the understanding to put this rewrite rule in place.
I need to only remove these characters from any URL on our website.
We have pages generated for specific users giving them a unique ID which is permanent and added to the end of every page that they visit. Ideally we would like to hide ?rid= within the URL whenever it occurs.
Really appreciate some help on this