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+$