1

I have many pages with the parameter SID= indexed in Google which I would like to noindex, eg https://www.example.com.au/checkout/cart/?SID=c79e6055436bf371a02f4d2601cecd03

I have used the following code in htaccess but it doesn't seem to match?

RewriteCond %{QUERY_STRING} ^SID=$
RewriteRule ^(.*)$ - [env=NOINDEXFOLLOW:true]
Header set X-Robots-Tag "noindex, follow" env=NOINDEXFOLLOW
hjpotter92
  • 78,589
  • 36
  • 144
  • 183
bondimedical
  • 201
  • 4
  • 11

1 Answers1

0

In your RewriteCond directive, you are trying to match against:

^SID=$

which means, that the %{QUERY_STRING} will start with SID= and has nothing else after that. This is not the case here. Update the code to:

RewriteCond %{QUERY_STRING} ^SID=
RewriteRule ^ - [env=NOINDEXFOLLOW:true]

Header set X-Robots-Tag "noindex, follow" env=NOINDEXFOLLOW
hjpotter92
  • 78,589
  • 36
  • 144
  • 183