0

Recently my website was hacked and now I have around 20000 indexed links in Google that were redirected to other sites via my website. Now I have stopped all redirects but I have too many request on my host. All indexed links in Google are something like this:

  • example.com/?mode=list1124413.html

  • example.com/?mode=grid125761916.html

I want to block all requests starting with ?mode but I don't know why these configurations I have tried are not working:

RewriteCond     %{QUERY_STRING} ".*(?:^|&)mode=(?:=|&|$)"
RewriteRule     "" "-" [F]

RedirectMatch 404 ^?mode/\d+$
RedirectMatch 404 ^mode\d+$

1 Answer 1

0

It is not possible to match query strings with mod_alias:

mod_alias is designed to handle simple URL manipulation tasks. For more complicated tasks such as manipulating the query string, use the tools provided by mod_rewrite.

A working configuration with mod_rewrite:

RewriteEngine  On
RewriteCond    %{QUERY_STRING} "(^|&)mode="
RewriteRule    "" "-" [F]

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .