Googlebot is crawling my site and entering ratings on my rating system

核能气质少年 提交于 2019-12-13 12:49:44

问题


My rating system allows anonymous users to add ratings, but Google's crawler is rating things.

How can I ensure that Googlebot won't follow the link?


回答1:


You shouldn't accept a GET request for any action that modifies data (voting, editing a post, etc.). Your voting should be done via a POST request, which Googlebot won't perform.

More information in this SO post: When do you use POST and when do you use GET?




回答2:


Use a robots.txt to point out links that bots shouldn't follow. For example, put the following in http://example.com/robots.txt

User-Agent: *
Disallow: /vote.php

You can read more about robots.txt here: http://www.robotstxt.org/

Google and every other well-behaved bot will read and follow directions in robots.txt.

If you also have problems with bots not following those directions you will have to code some logic to block bots, or at least to decrease their impact. You can for example log how many votes you've got from an IP address in a certain time frame and block votes above that level. Another solution can be to only allow posts, and also have some JS logic (or similar) to block out spam bots, but that's much more work than robots.txt so only put time into it if it becomes a problem.

You can also block bad-behaving bots entirely by blocking their IPs in your web server. There are a few lists of bad-behaving bots out there you can try if you prefer the block solution.



来源:https://stackoverflow.com/questions/3978499/googlebot-is-crawling-my-site-and-entering-ratings-on-my-rating-system

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!