×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: bejoy balan
Added: Nov 14, 2014 9:19 AM
Views: 14
htaccess robots User-agent Rewrite
  1. Example: Robot blocking
  2.  
  3. Scenario:
  4. In this example we want to block all requests made by an annoying robot. Usually the robots are identified by their name contained in the "User-agent" HTTP header.
  5.  
  6. Configuration:
  7.  
  8. #Turn IIS Mod-Rewrite engine on
  9. RewriteEngine On
  10.  
  11. #Check if "User-agent" HTTP header contains "AnnoyBot"...
  12. RewriteCond %{HTTP_USER_AGENT} AnnoyBot [NC]
  13. #...and if so, send a "Forbidden" HTTP header for any request.
  14. RewriteRule .* - [F]
  15.