2

I've been trying to 410 a pattern of a few thousands toxics URLS that got indexed by Google for one of my clients. I want every urls of the website that contain ?% to send a 410 response code so they got de-indexed.

Example of an URL :

https://www.example.com/fr/promotions?%25252525253Bid_lang=6&p=6

I've tried to put this in the .htaccess, above the If module section, as I found on another thread here, but it didn't work, any ideas ?

RewriteRule ^[a-z]shop($|/) - [G]
MrWhite
  • 43,179
  • 8
  • 60
  • 84
Fanfan
  • 23
  • 3
  • "I found on another thread" - I'm curious what other "thread" this was from? The code you posted would seem to be unrelated to what you are trying to do and is more likely to cause damage?! – MrWhite May 05 '22 at 15:40

1 Answers1

3

I want every urls of the website that contain ?% to send a 410 response code

Using mod_rewrite at the top of the .htaccess file:

# Send 410 for any URL where the query string starts with "%"
RewriteCond %{QUERY_STRING} ^%
RewriteRule ^ - [G]
MrWhite
  • 43,179
  • 8
  • 60
  • 84