htaccess 301 Redirect URLs with Parameters on it

Add this code to the top of your htaccess file


RewriteEngine On
RewriteBase /

#if the query string has an a parameter
RewriteCond %{QUERY_STRING} (^|&)a= [NC]
#Redirect and remove query string parameters
RewriteRule .*  http://www.mysite.com/? [R=301,L]

#if the query string has a pagewanted parameter
RewriteCond %{QUERY_STRING} (^|&)pagewanted=all [NC]
#Redirect and remove query string parameters for html pages
RewriteRule (.+\.html)  http://www.mysite.com/$1? [R=301,L]
 
Will redirect
www.mysite.com/index.php?a=some-other-thing
to   
www.mysite.com 
 
To redirect specific URL with parameters
EX.
Redirect only:
www.mysite.com/index.php?a=something-something-something
But not all with "a="  Use the second block of codes

#if the query string has a pagewanted parameter
RewriteCond %{QUERY_STRING} (^|&)pagewanted=all [NC]
#Redirect and remove query string parameters for html pages
RewriteRule (.+\.html)  http://www.mysite.com/$1? [R=301,L]