Google is currently indexing query strings URLs of my website. Google has currently indexed almost 112k URLs that all are duplicate version of other URLs causing my website to slow down and negatively effecting my SEO.

The structure of query strings URL is as follows:


I have contacted search community earlier and they have suggested me to add no index meta tags in my .htacces file with the following code

<If "%{QUERY_STRING} =~ /te=/"> Header set X-Robots-Tag noindex </If>

Also, I have tried it using robot.txt file to block those URLs but no relief.

It's been two weeks since I added this code on my .htacces file in my cPanel but still google is indexing those query string parameter URLs.

I am unable to figure out what's the issue please suggest me a possible solution for this as it hitting my website tremendously day by day :(

  • 1
    Is the te= parameter something that your site actually uses? If not, I'll bet your site is hacked and you need to do a clean install. May 12, 2023 at 9:10
  • My site is not hacked I've checked it many times and scanned it through my cpanel also. May 12, 2023 at 9:47
  • 1
    What do you use the te= params for? May 12, 2023 at 9:53
  • 2
    ... but what do you use the te URL parameter for? If this URL param is added erroneously and not used by your application then you would implement a "redirect", otherwise you would implement something like what you are already trying. Are you seeing the X-Robots-Tag in the HTTP response for these requests? Presumably you don't have the <If> container all on one line as you have posted here? "using robot.txt file" - you are missing an s; it's robots.txt. "my .htacces file" - you are missing an s; it's .htaccess! If you have missed the s then it's certainly not going to work.
    – MrWhite
    May 12, 2023 at 10:45
  • 1
    Most of the reason that I suspect your site is hacked is that Google wouldn't index the pages if they ware actually duplicate content. It sounds like the hack is modifying your site for Googlebot and visitors from Google. You might not even see the hacked content visiting the site yourself. You don't say how you checked if you site is hacked, but if haven't done so, you need to do a live inspection of your URLs with those parameters from Google Search Console and look at your pages as Googlebot sees them. May 12, 2023 at 11:25

1 Answer 1


Bots (or anyone) can add query parameters to your URLs, and they will probably still function (unless you've specifically forced it to not work), so there's no purpose in trying to stop that. Even Facebook uses URL parameters added to URLs occasionally. To avoid them being indexed though:

  1. Make sure the valid URLs you want indexed are in your sitemap, and invalid URLs are not. If you have no sitemap, it may be a good idea to get one.

  2. If you're able, put a canonical tag on EVERYTHING. That way, Google will recognize the intended URLs. Examples:

Valid url: example.com
Canonical: example.com

Invalid url: example.com?te=6.18.1346158.4.18.76.huffy+blue+and+white+bike
Canonical: example.com

Valid url: example.com/contact-us.php
Canonical: example.com/contact-us.php

Invalid url: example.com/contact-us.php?te=blabla
Canonical: example.com/contact-us.php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.