htaccess – Redirect while removing query parameter

The parameter being removed in this example is ‘qwerty’ with up to 5 numeric digits afterwards.

RewriteCond %{QUERY_STRING} qwerty=[0-9]{1,5} [NC]
RewriteRule (.*) http://mysite.com/$1? [R=301,L]

The question mark in the RewriteRule is what tells Apache to not include the query parameter during the rewrite.