0
votes

I have not been able to deny access to a User-Agent, I have tried two different solutions in .htaccess:

Order allow,deny

Allow from all

SetEnvIf User-Agent "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1" bad_ua=1

Deny from env=bad_ua

and

RewriteCond %{HTTP_USER_AGENT} "^Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1"

RewriteRule ^ - [F,L]

neither works any help would be welcome John

1

1 Answers

0
votes

The answer is the quotes around the user-agent do not help -you have to escape every non alphanumeric char, so this works fine:

RewriteCond %{HTTP_USER_AGENT} "Mozilla/5.0\ (Windows\ NT\ 6.1\;\ WOW64\;\ rv:40.0)\ Gecko/20100101\ Firefox/40.1"

RewriteRule .* - [F]