.htaccess 如何屏蔽恶意域名抓取?

如何屏蔽恶意域名抓取?
Linux主机,.htaccess 规则改怎么写呢?

默认.htaccess 是这样的 ,设置了伪静态。

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
阅读 13.2k
2 个回答
#禁止某个来源(referer)的访问
RewriteEngine on
RewriteCond %{HTTP_REFERER} hg6971\.cc [NC,OR]
RewriteCond %{HTTP_REFERER} 00gy7\.net [NC,OR]
RewriteCond %{HTTP_REFERER} hytcyx950\.cc [NC,OR]
RewriteCond %{HTTP_REFERER} zrtb351\.cc [NC,OR]
RewriteCond %{HTTP_REFERER} jcgjbyw828\.cc [NC,OR]
RewriteCond %{HTTP_REFERER} xgdmwwz2216\.cn [NC,OR]
RewriteCond %{HTTP_REFERER} huaishushu\.cc [NC,OR]
RewriteCond %{HTTP_REFERER} lxjj\.loan [NC,OR]
RewriteCond %{HTTP_REFERER} hg1031\.cc [NC,OR]
RewriteCond %{HTTP_REFERER} yman\.com [NC,OR]
RewriteCond %{HTTP_REFERER} 6949187\.cn [NC,OR]
RewriteCond %{HTTP_REFERER} yzcyl479\.cc [NC,OR]
RewriteCond %{HTTP_REFERER} 01ar8\.net [NC,OR]
RewriteCond %{HTTP_REFERER} abbbna\.win
RewriteRule .* - [F]

这是我目前使用的,供你参考一下

  1. 修改robots.txt文件 把文章目录直接保护起来

User-agent: *
Disallow: /blog/
  1. 可以修改.htaccess文件

RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} Googlebot [OR]
RewriteCond %{HTTP_USER_AGENT} AdsBot-Google [OR]
RewriteCond %{HTTP_USER_AGENT} msnbot [OR]
RewriteCond %{HTTP_USER_AGENT} AltaVista [OR]
RewriteCond %{HTTP_USER_AGENT} Slurp
RewriteRule .* - [R=403,L]
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进