Reputation: 1
I was trying to write rewrite rule to return 404 on urls with spam parameters.
I used the following rewrite tool to return error 404 with query string voxter.pdf&gpvoq
and parameters gpvoq
but its not producing 404 error.
RewriteCond %{voxter.pdf&gpvoq} (^|&)parm1=gpvoq [NC]
RewriteRule (.*)/error-404.php? [R=404,L]
Can u please help me what mistake I am doing?
Upvotes: 0
Views: 37
Reputation: 143886
%{voxter.pdf&gpvoq}
isn't an apache variable. That will only match itself as a literal. You need to be using the %{QUERY_STRING}
variable instead:
RewriteCond %{QUERY_STRING} (voxter.pdf|gpvoq) [NC]
RewriteRule ^ /error-404.php? [R=404,L]
or some similar regex.
Upvotes: 1