Despite searching extensively I cannot seem to find an answer, so I apologise if this has been asked before and I’ve simply missed it.
I have a site with only static URIs, all SEO friendly, hard-coded in the .htaccess file. Unfortunately we’re seeing a lot of other sites linking to us with query strings searching for unsavoury things. This is hurting our search ranking and we’d like to return a 404 for anything with a query string.
I’ve tried variations on the following, without success:
RewriteCond %{QUERY_STRING} .
RewriteRule ^404.php/? [R,L]
Any help would be appreciated.
This should achieve what you are trying to do.