您的位置:首页 > 运维架构 > Apache

让apache选择性的决绝某些user-agent

2011-05-17 21:51 134 查看
 cat /etc/httpd/conf/httpd.conf |grep -v ^#
针对的user-agent的参数,用匹配的方式过滤掉某些不希望被访问的地址。

vim /etc/httpd/conf/httpd.conf

BrowserMatch  "Mozilla" bad_bot

BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4/.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4/.0" force-response-1.0
BrowserMatch "Java/1/.0" force-response-1.0
BrowserMatch "JDK/1/.0" force-response-1.0

#
# The following directive disables redirects on non-GET requests for
# a directory that does not include the trailing slash.  This fixes a
# problem with Microsoft WebFolders which does not appropriately handle
# redirects for folders with DAV methods.
# Same deal with Apple's DAV filesystem and Gnome VFS support for DAV.
#
BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
BrowserMatch "MS FrontPage" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^WebDAVFS/1.[0123]" redirect-carefully
BrowserMatch "^gnome-vfs/1.0" redirect-carefully
BrowserMatch "^XML Spy" redirect-carefully
BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully

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









内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: