W
W
WTERH2018-08-12 23:26:48
PHP
WTERH, 2018-08-12 23:26:48

How to block all possible search bots?

There is a task to block access to indexing by all possible search engines and their spiders/bots.
I want to do it the right way.
I'm currently thinking about something like this:

$ua = $_SERVER['HTTP_USER_AGENT'];
if(mb_strpos($ua, "bot") || mb_strpos($ua, "crawler") || mb_strpos($ua, "spider")){
header("Location: some.url");
}
else{
...
Содержимое страницы
...
}

But I'm not sure that this is correct or that all possible options are taken into account.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2018-08-12
@Expany

what's the point? normal search engines react to a ban in robots.txt, and abnormal ones can have any UA.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question