For reasons that aren't worth going into here, Google has been indexing one of my sites with unnecessary query strings in the URL which are wordfence_lh
, hid
and wordfence_logHuman
. I'd like to modify my .htaccess
file to remove all those query strings.
My URLs
example.com/page/111/?wordfence_lh=1&hid=CA2BA660BEFF26B9A17F8F85D7391BD4
example.com/page/80/?wordfence_logHuman=1&hid=647700EBF43600E7BC54103256F1D71B
Expected URLs
example.com/page/111/
example.com/page/80/
I've found a way to remove a single parameter, but I still can't find a regex or something to remove multiple query parameters. Any help is greatly appreciated, thanks so much!
Here's a part of my .htaccess
file:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} on [OR]
RewriteCond %{SERVER_PORT} ^555$ [OR]
RewriteCond %{HTTP:X-Forwarded-Proto} https
RewriteRule .* - [E=WPR_SSL:-https]
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteRule .* - [E=WPR_ENC:_gzip]
RewriteCond %{REQUEST_METHOD} GET
RewriteCond %{QUERY_STRING} =""
RewriteCond %{HTTP:Cookie} !(wordpress_logged_in_.+|wp-postpass_|wptouch_switch_toggle|comment_author_|comment_author_email_) [NC]
RewriteCond %{REQUEST_URI} !^(/(.+/)?feed/?.+/?|/(?:.+/)?embed/|/(index\.php/)?wp\-json(/.*|$)|/cantonicalt/)$ [NC]
RewriteCond %{HTTP_USER_AGENT} !^(facebookexternalhit).* [NC]
RewriteCond "%{DOCUMENT_ROOT}/wp-content/cache/wp-rocket/%{HTTP_HOST}%{REQUEST_URI}/index%{ENV:WPR_SSL}%{ENV:WPR_WEBP}.html%{ENV:WPR_ENC}" -f
RewriteRule .* "/wp-content/cache/wp-rocket/%{HTTP_HOST}%{REQUEST_URI}/index%{ENV:WPR_SSL}%{ENV:WPR_WEBP}.html%{ENV:WPR_ENC}" [L]
</IfModule>