block bot on uri with query_string

ron ramos nhadie at
Sun Jul 28 02:55:52 UTC 2013

Hi All,

Been trying to block bots from accessing a URI that has a query_string
"action=get_it", i tried below

        location ~* \?(action=get_it)$ {

                if ( $http_user_agent ~
(crawl|Googlebot|Slurp|spider|bingbot|tracker|click|parser|spider)) {

                        return 404;




i just learned that location does not match query string, if i do the
is_arg i cant do nested if, anyone able to do this before?



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list