I understood your question perfectly, because it is a trivial bit of code.
The following is almost a direct copy-and-paste from the end of the very first thread listed in the search results at the search link I posted above. That code probably would have worked fine for you, but I took the liberty of improving it slightly, with no change to function:
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^/]+/)*index\.php([?#][^\ ]*)?\ HTTP/
RewriteRule ^(([^/]+/)*)index\.php$ http://www.example.com/$1 [R=301,L]
Because no query string is specified in the rewriterule, the original query string(s) --if any-- will be passed through unchanged.
If this is not what you want, then the problem is an insufficient requirements specification -- Specifically, for those URLs+querystrings that you wish to redirect, what part or parts of your "somestring=somevalue" query are fixed, and what part or parts can change? If parts can change, what are the possible valid characters, string lengths, etc.?
To describe such things, use statements like "The query string is always a single name/value pair, with the name always being exactly "somestring" and the value being 1 or more lowercase alphanumeric characters including non-contiguous hyphens allowed in any but the first or final position."
That kind of specification makes it easy to get a correct answer fast, since the "value" subpattern is fully described and the query string pattern can be directly coded as: "^somestring=([a-z0-9](-?[a-z0-9]+)*)$"
Jim