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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -