How to block "bot*" bot via .htaccess -
i have following entry in awstats file:
unknown robot (identified 'bot*')
how can block bot?
tried following separately none of them seems catching it:
rewritecond %{http_user_agent} ^bot* rewritecond %{http_user_agent} bot\* rewritecond %{http_user_agent} bot[*]
here full .htaccess code using:
rewriteengine on rewritecond %{http_user_agent} ^bot* rewriterule .? - [f,l]
tested 3 regex values (^bot*, bot\*, bot[*]) in second line, none of them stopped bot.
the asterisk (*
) not literal. awstats stating used particular rule check if request being made bot. in case, bot*
means user agent string started bot
, , found match.
as asterisk not literal, can use following instead:
rewritecond %{http_user_agent} ^bot [or] # matches bot* (the same ^bot.*$) rewritecond %{http_user_agent} bot$ # matches *bot (the same ^.*bot$)
note: should here better check access logs see these user agents , block them specifically. don't want find in position whereby blocking bots might want.
recommendation: change rule
rewriterule .? - [f,l]
rewriterule ^ - [f,l]
Comments
Post a Comment