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

标签 .htaccess

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

最佳答案

#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

关于.htaccess - 如何阻止空的用户代理请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23200076/

相关文章:

php - 我想将我的 joomla URL 转换为用户友好的 URL

php - 使用 .htaccess 重写一个简单的 url

php - 如何限制每个IP只能有1个用户访问网站?

php - 如何在 php htaccess 文件中的正则表达式中使用#

.htaccess - (htaccess) 将 php 文件的英文名称重写为其荷兰语等效名称

.htaccess - 使用 htaccess 重写规则的多域重定向

php - .htaccess 重定向到 404 页面 RewriteRule

.htaccess - Codeigniter 使用 mod_rewrite 重复内容

php - 使用本地 htaccess 文件 (Apache) 实现内容安全策略

php - 如何在地址栏中使用 utf8 url