Skip to main content

Prevent Search Engines from crawling the url with queries and try it

RewriteEngine On
RewriteBase /
# Target search engine bots
RewriteCond %{HTTP_USER_AGENT} (Googlebot|Google-InspectionTool|bingbot|Slurp|DuckDuckBot|Yandex|Baiduspider) [NC]
# Rule 1: Return 410 for any URL with a query string (for search engines only)
RewriteCond %{QUERY_STRING} .+
RewriteRule ^ - [G]

if you want to exclude the sitemap.xml from this then do it like this 

 

RewriteEngine On
RewriteBase /
# Target search engine bots
RewriteCond %{HTTP_USER_AGENT} (Googlebot|Google-InspectionTool|bingbot|Slurp|DuckDuckBot|Yandex|Baiduspider) [NC]
# Rule 1: Return 410 for any URL with a query string (for search engines only)
RewriteCond %{REQUEST_URI} !sitemap\.xml$ [NC]
RewriteCond %{QUERY_STRING} .+
RewriteRule ^ - [G]

 

and to try it

# curl -I -A "Google-InspectionTool" "https://www.example.com/catalogsearch/result/index?q=MOWOX&brand=1682"

Tags