Detect if your site is accessing a robot

I have some geo-targeting code that I want to conduct in a certain way if the site is broken up by a robot, for example. google etc.

Is there any way to do this?

+3
source share
4 answers

Presenting various content to search robots and human visitors - cloaking - is risky, and can be punished by the search engine if they are detected.

So, check out this SO answer with a few links to supported "bot lists." You will need to parse the string USER_AGENT and compare it with such a list of bots.

+5
source

, - IP-. , , , - . google . IP- , IP- .

+2

user-agent. , : http://www.user-agents.org/ "R = , , ". , user-agent , 100% .

+1

, . Google, Yahoo, MSN/Live/Bing/whatever-it-is-today, Ask .., DNS .

1) ( , ​​ googlebot)
Mozilla/5.0 (; Googlebot/2.1; + http://www.google.com/bot.html

2) DNS IP- , .
rdns 66.249.71.202 - crawl-66-249-71-202.googlebot.com( , googlebot.com)

3) On this, you can fake your own step 2, so now check the dns of the A record for the result returned in step 2, and make sure that you have the original requesting IP.
For example, the dns for the above is crawl-66-249-71-202.googlebot.com. A 66.249.71.202

66.249.71.202 was the requesting IP address, so this is a valid googlebot.

+1
source

Source: https://habr.com/ru/post/1732886/


All Articles