F
F
fStrange2017-06-30 23:17:17
htaccess
fStrange, 2017-06-30 23:17:17

How to block url containing chinese characters via .htaccess?

A lot of requests for two URLs fall on the site. One is Cyrillic, the other contains Chinese characters.
There are a lot of requests, these are bots from different IPs and they bring down the site.
example

GET /%E9%82%AA%E5%86%99%E5%B1%91%E6%87%88%E8%96%AA%E6%87%88%E8%A4%8B%E8%A4%8C%E8%A4%89%E9%82%AA%E8%A4%8C%E8%8A%AF%E8%A4%89

in .htaccess
RewriteCond .{REQUEST_URI}  ^/%E9%82%AA%E5%86%99%E5%B1%91%E6%87%88%E8%96%AA%E6%87%88%E8%A4%8B%E8%A4%8C%E8%A4%89%E9%82%AA%E8%A4%8C%E8%8A%AF%E8%A4%89  [NC]
RewriteRule .* - [F]

does not work
I solved the task itself by other methods.
And through .htaccess it is solved?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2017-07-11
@shambler81

GET is not part of the url, and it is simply not in REQUEST_URI

RewriteCond %{QUERY_STRING} (^|&)[\%??]{3,}($|&)
#если гет и или содержит %любые два символа 3 раза и более то
RewriteRule .* - [F]

(^|&)[\%??]{3,}($|&) - it's okay
(^|&)here is a get request($|&) - it's just that there can be more than one get and not start with ? and with &

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question