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

Popular posts from this blog

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

c# - Search and Add Comment with OpenXML for Word -