Htaccess - блокировка плохих ботов

Материал из Wiki - Iphoster - the best ever hosting and support. 2005 - 2023
Перейти к:навигация, поиск
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Самые выгодные сервера‎


Как заблокировать ботов через htaccess

Отдавать 403 ботам badbot, badbot1 - добавляем в .htaccess:

RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} (badbot|badbot1) [NC]
RewriteRule .* - [R=403,L]

Тут

NC - no case - ни при каких обстоятельствах
L - last rule - последнее правило
OR - или

Пример:

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} (SemrushBot|MJ12bot|AhrefsBot|AspiegelBot|DotBot|LinkpadBot|SputnikBot|statdom.ru|MegaIndex.ru|WebDataStats|Jooblebot|Baiduspider|BackupLand|NetcraftSurveyAgent|openstat.ru) [NC]
RewriteRule ^.* - [F,L]



tags: #block bad bots thru htaccess



another one link: