Redirect user if URL contains a specific keyword with htaccess?
You need to deal with matching something in the path and matching something in the query string separately, since Apache does not provide a variable containing both. The first RewriteRule here matches "love" in the path, and the second rule limited by the RewriteCond matches "love" in the query string.
RewriteRule .*love.* - [R=404]
RewriteCond %{QUERY_STRING} .*love.*
RewriteRule .* - [R=404]