block robots for some urls

Igor Sysoev igor at sysoev.ru
Mon Jul 19 15:50:36 MSD 2010


On Thu, Jul 15, 2010 at 01:51:36AM +0300, bvidinli wrote:

> Hi,
> 
> I want to block some robots such as google, to access some urls.
> 
> here is my config:
> 
> 
> 			# robotlarin gezdigi luzumsuz adresleri blokla... zirt pirt
> giriyorlar sanki bisey varmis gibi
> 			set $test "";
> 			
> 			if ($request_filename ~* calendar) {
> 				set $test "blo";
> 			}
> 			
> 			if ($http_user_agent ~* google\.com ) {
> 				set $test "${test}ck1";
> 			}
> 			
> 			if ($test = "block1" ){
> 				return 444;
> 			}		
> 
> 
> this is as described in nginx config, for "and" ing some conditions.
> but, it do not work now,

   location ~ calendar {
       if ($http_user_agent ~* google\.com ) {
           return 444;
       }

       ...
   }

   ...


-- 
Igor Sysoev
http://sysoev.ru/en/



More information about the nginx mailing list