Please convert this .htaccess to NGINX rewrite

could somebody convert this .htaccess to NGINX rewrite,??
i need it stop my forum from automatic bot poster…

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} ^.(6a1pre). [NC]
RewriteRule ^(.*)$ - [F,L]

if u could help me, u’re the best !

Posted at Nginx Forum:

On 30 Dez 2010 08h06 WET, [email protected] wrote:

could somebody convert this .htaccess to NGINX rewrite,??
i need it stop my forum from automatic bot poster…

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} ^.(6a1pre). [NC]
RewriteRule ^(.*)$ - [F,L]

if ($http_user_agent ~* “^.(6a1pre).”) {
return 403;
}

— appa

its not working, :frowning: i think its not true antonio…

Posted at Nginx Forum:

On 31 Jan 2011 15h55 WET, [email protected] wrote:

its not working, :frowning: i think its not true antonio…

It should work. But the User Agent string must contain ‘(6a1pre)’.

You can test it yourself with wget.

wget -U ‘This is a test of the evil UA (6a1pre) indeed’

you should get a 403 status code as the result.

— appa