Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Fri Aug 30, 2013 12:32 pm 
Offline
Senior Member

Joined: Thu Jun 13, 2013 7:32 am
Posts: 79
Hello, I know I can use robots.txt but I'd like to mess with a more immediate solution. I tried something like this, but then when I went to view it in browser, it gave 404 so I think my code is wrong. I placed this in the server block in /etc/nginx/sites-enabled/example.com.

Code:
# Block some bots from everything in this directory
location = /schedule/ {
   if ($http_user_agent ~* "Googlebot|bingbot") {
       return 403;
   }
}


Top
   
PostPosted: Fri Aug 30, 2013 4:31 pm 
Offline
Senior Member

Joined: Fri Feb 17, 2012 8:20 pm
Posts: 365
It's probably not working because you have quotes around the things you want to block
Try
Code:
if ($http_user_agent ~* (googlebot|bingbot) ) {
    return 403;
}


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group