apache屏蔽指定的来路

屏蔽来路
SetEnvIfNoCase Referer “^http://www.baidu.com/” local_ref=1

Order Allow,Deny
Allow from all
Deny from env=local_ref

屏蔽指定agent
The first line we add to our config file is:

SetEnvIfNoCase User-Agent “^Wget” bad_bot
SetEnvIfNoCase User-Agent “^EmailSiphon” bad_bot
SetEnvIfNoCase User-Agent “^EmailWolf” bad_bot

The ‘SetEnvIfNoCase’ simply sets an enviornment (SetEnv) variable called ‘bad_bot’ If (SetEnvIf) the ‘User-Agent’ string contains Wget, EmailSiphon, or EmailWolf, regardless of case (SetEnvIfNoCase). In english, anytime a browser with a name containing ‘wget, emailsiphon, or emailwolf’ accesses our website, we set a variable called ‘bad_bot’. We’d also want to add a line for the User-Agent string of any other Spidert we want to deny.

Now we tell Apache which directories to block the Spiderts from with the directive:


Order Allow,Deny
Allow from all
Deny from env=bad_bot

其他有用的资料
http://httpd.apache.org/docs/1.3/logs.html