Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have downloaded my access log file from my cPanel and found I have a bot I would like to stop. In the access log, there User-Agent string reads the following; - - [08/May/2014:23:29:52 -0500] "GET / HTTP/1.0" 301 - "-" "-" - - [08/May/2014:23:29:56 -0500] "GET / HTTP/1.0" 200 29019 "-" "-"

What is the proper format in my .htaccess file to block this bot only?

share|improve this question
There is no user agent string in there –  John Conde May 9 '14 at 19:20
Those are complete access log entries. The User-Agent is just the last part ie. "-" (a single hyphen, which probably represents an empty user agent string.) –  w3d May 9 '14 at 20:20

1 Answer 1

To block all "blank" User-Agents or User-Agents consisting of a hyphen, you could use the following in your .htaccess

RewriteCond %{HTTP_USER_AGENT} ^-?$
RewriteRule ^ - [F]
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.