如何阻止空的用户代理请求

时间:2014-04-21 15:08:29

标签: .htaccess

是否有任何解决方案可以阻止具有空用户代理字符串的http请求,最好使用.htaccess?

1 个答案:

答案 0 :(得分:1)

#redirect empty user agent, UNLESS it's accessing the RSS feed
RewriteCond %{HTTP_USER_AGENT} ^$ 
RewriteCond %{REQUEST_URI} !^/rss.php # <-- path to rss.php
RewriteRule .* http://%{REMOTE_ADDR}/ [R,L]

来源:http://wiki.e107.org/index.php?title=Htaccessexample