apache禁止指定user_agent和禁止解析php
更新:HHH   时间:2023-1-7


   <IfModule mod_rewrite.c>
        RewriteEngine on

          RewriteCond %{HTTP_USER_AGENT}  ^.*curl.* [NC,OR]

          RewriteCond %{HTTP_USER_AGENT}  ^.*chrom* [NC]

        RewriteRule  .*  -  [F]
    </IfModule>

测试:[root@www ~]# curl -x127.0.0.1:80 www.test.com/forum.php(会提示<title>403 Forbidden</title>)

[root@www ~]# curl -x127.0.0.1:80 www.test.com/adkljh(也是403)

[root@www ~]# curl -x192.168.137.2:80 www.test.com/asdfg(也是403)

现在把curl那行注释,[root@www ~]# curl -x192.168.137.2:80 www.test.com/asdfg(会提示404)

[root@www ~]# curl -x192.168.137.2:80 www.test.com/forum.php -I(会提示200)





返回web开发教程...