0

I really can't find a solution, can someone pleas tell me how to block the following specific user agent exactly via isapi rewrite 3.0?

I want to block:

Mozilla/5.0 (Windows NT 6.1; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0

Current solution, but doesn't work:

RewriteCond %{HTTP:User-Agent} ^Mozilla/5.0\ (Windows\ NT\ 6.1;\ WOW64;\ rv:28.0)\ Gecko/20100101\ Firefox/28.0 [NC]
RewriteRule .? - [F]

I tried so many ways but it doesn't seem to work...

Please help!

msturdy
  • 10,479
  • 11
  • 41
  • 52
  • That's the user-agent i want to block with Helicon's Isapi Rewrite 3.0: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0 That's my last solution: RewriteCond %{HTTP:User-Agent} Mozilla/5.0\ (Windows\ NT\ 6.1;\ WOW64;\ rv:28.0)\ Gecko/20100101\ Firefox/28.0 [NC] RewriteRule .? - [F] But the user-agent isn't blocked... it can only depend on some syntax errors – user3668758 May 23 '14 at 12:31
  • Thank you! ... but yes I have... I got that site about 5 times today while trying to find a solution... maybe there is a problem with the blanks or something else...? – user3668758 May 23 '14 at 12:37
  • done... which other information do you need? – user3668758 May 23 '14 at 12:45
  • Logically, you should explain what happens when someone with that User Agent goes to the site currently, and what do you want to happen. – msturdy May 23 '14 at 12:56
  • What happens: nothing. the RewriteCondition doesnt work What i want to happen: Clients with that User-Agents should be blocked. RADICALLY :) (RewriteRule .? -[F]) that's all i want. No redirection. Just blocking. Helicon's Isapi Rewrite works fine for me with other rules about url-rewriting..., but I'am driving insane cause I know there must only be a tiny syntax mistake in my command... Let me ask my question more exactly: I want the condition to return true for that useragent but it doesn't work. Where is the error? Thank you so much for helping me! – user3668758 May 23 '14 at 13:03
  • try escaping the brackets in the UA string.. `\(` and `\)` – msturdy May 23 '14 at 13:22
  • done... i'll let you know if this works thank you so much! – user3668758 May 23 '14 at 13:25
  • Problem solved: msturdy - you are my hero! So easy but hard enough for blind rewrite noobs like me :) thank you so much! – user3668758 May 23 '14 at 15:58

1 Answers1

1

You need to escape the ( and ) characters in your UA string:

RewriteCond %{HTTP:User-Agent} ^Mozilla/5.0\ \(Windows\ NT\ 6.1;\ WOW64;\ rv:28.0\)\ Gecko/20100101\ Firefox/28.0 [NC]
RewriteRule .? - [F]

( and ) are special characters in Regex

msturdy
  • 10,479
  • 11
  • 41
  • 52