htaccess中的僵尸僵尸IP仍在访问网站

时间:2015-09-23 11:27:58

标签: .htaccess bots

我正在使用Xenforo网站阻止僵尸程序(抓取工具)的IP,因为它在服务器上疯狂。

我添加了三行来实现此更改,但他们一直在抓取我的网站。

Order Deny,Allow
Deny from 93.158.178.201

RewriteCond %{HTTP_USER_AGENT} ^YandexBot [OR]

这就是我的整个.htaccess文件的样子:

#   Mod_security can interfere with uploading of content such as attachments. If you
#   cannot attach files, remove the "#" from the lines below.
#<IfModule mod_security.c>
#   SecFilterEngine Off
#   SecFilterScanPOST Off
#</IfModule>

ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 500 default

<IfModule mod_rewrite.c>
    RewriteEngine On

    #   If you are having problems with the rewrite rules, remove the "#" from the
    #   line that begins "RewriteBase" below. You will also have to change the path
    #   of the rewrite to reflect the path to your XenForo installation.
    #RewriteBase /xenforo

    #   This line may be needed to enable WebDAV editing with PHP as a CGI.
    #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
        RewriteCond %{HTTP_USER_AGENT} ^YandexBot [OR]
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
</IfModule>

Order Deny,Allow
Deny from 93.158.178.201

我做错了吗?

编辑:在您的评论和回答之后,我的网站上仍然有Yandex bot ...

93.158.178.201 - - [23/Sep/2015:13:56:23 +0200] "GET /threads/g%C3%BCnl%C3%BCk-blog2014.8514/page-87 HTTP/1.1" 403 521 "-" "Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots)"

1 个答案:

答案 0 :(得分:1)

Yandex机器人有以下User-Agent字符串:

User-Agent Mozilla/5.0 (compatible; Yandex...)

来自Yandex support

  

User-Agent Mozilla/5.0 (compatible; Yandex...)字符串标识   Yandex机器人。机器人可以发送GET(例如YandexBot/3.0)   和HEADYandexWebmaster/2.0)对服务器的请求。反向DNS   查找可用于检查Yandex机器人的真实性。

试试这个:

RewriteCond %{HTTP_USER_AGENT} compatible;\ yandex [NC]
RewriteRule ^ - [F,L]

F标志将禁止机器人抓取您的网页。