For some reason, we recieving a bunch of inbound traffic on URLs that contain HTML entities.
E.g.
http://www.ourdomain.com/index.php?key1=value1&am
This should do the trick;
RewriteEngine On
RewriteCond %{QUERY_STRING} (.*)&(.*)
RewriteRule .* /index.php?%1&%2 [N,R=301]
This essentially says;
& in the query string?&N flag in the rule effectively says 'keep doing this until the condition no longer makes a match'Check out the mod_rewrite documentation, including RewriteCond and rule flags.