How to redirect query string with htaccess

I’m new here and I got this htaccess code to redirect:

301 Redirect Entire Directory

RedirectMatch 301 teamfront.php?(.*) /$1

It is redirecting fine from:
example.com/teamfront.php?Adobe-Acrobat-XI-Standard
to
example.com/?Adobe-Acrobat-XI-Standard
but not linking to respective page
also fine if it link to:
example.com/Adobe-Acrobat-XI-Standard
anybody please help me. Thanks in advance

I’m pretty sure you can’t do that with RedirectMatch since it doesn’t take the query string into account.

What you want is something along the lines of


Options +FollowSymlinks -MultiViews

RewriteEngine On
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^teamfront\\.php$ /%1 [L,R=302]

Once it all works, replace 302 with 301 (browsers cache 301 so it’s very hard to test rules with 301, but they don’t cache 302, so it’s easier to test with that).

Thanks for reply, I try to copy the above code and paste into htaccess but it is not working, getting 404 error instead. I try with 301 too but no luck.

Please anybody help me to solve above issue, It would be great full for me…