Redirect - remove custom query string
I have a problem with some page URLs. The page URL structure is like this:
www.example.com/wp/custom-taxonomy/somepagename/?token=12345
I want that when I access the URL above to redirect me to:
www.example.com/wp/custom-taxonomy/somepagename/
In /wp/ is WordPress installed. I tried this in .htaccess:
IfModule mod_rewrite.c
RewriteEngine On
RewriteBase /wp/
RewriteCond %{query_string} ^token=12345
RewriteRule (.*) /$1? [R=301,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wp/index.php [L]
/IfModule
but it redirects me to:
www.example.com/custom-taxonomy/somepagename
Any ideas?
Later edit:
/wp/ - the folder where Wordpress is installed;
/custom-taxonomy/ - a custom taxonomy, like /partners/ where I enter all my partners.
/somepagename - a dynamic page, like /xyz-ltd, /abcd... dynamic pages created for the custom taxonomy.
I can not put a rule for every page, would need a general rule to remove the query string.