I need to remove session IDs (SID=xxxxx) from query strings for certain bots if it is present. Any other variables in the query string (should any exist) should be left unaltered. The position of SID within the query string is unknown.
Can somebody confirm if this is correct please.
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^(slurp|googlebot) [NC]
RewriteCond %{QUERY_STRING} ^(.*&)?SID=([^&]+)(&.*)?$ [NC]
RewriteRule .* %{REQUEST_URI}?%1%3 [R=301,L]