I'm trying to remove any instance of ?s= from any url its placed into.
This is the current rewrite rule I'm using but it just throws a 500 error any idea why?
RewriteCond %{QUERY_STRING} ^s=$
RewriteRule ^(.*)$ $1 [L,R=302,QSD]
You might be on older Apache versions because flag QSD is only supported on newer Apache versions 2.4+. On older Apache versions this will cause 500 internal server error.
You can use this rule instead:
RewriteCond %{QUERY_STRING} ^s=$
RewriteRule ^ %{REQUEST_URI}? [L,R=302]
? in target URL will discard existing query string.