robots.txt file for Web site

Source: Internet
Author: User

What is robots.txt?

Robots.txt is a plain text file that is the first file to be viewed when crawling a Web site, typically located at the root of the site. The robots.txt file defines the restrictions that the crawler has when crawling the site, which parts of the crawler can crawl and which cannot be crawled (anti-gentleman)

More robots.txt protocol Information reference: www.robotstxt.org

Before crawling a Web site, check the robots.txt file to minimize the possibility of spiders being banned

The following is part of the Baidu Robots.txt Agreement: Https://www.baidu.com/robots.txt

1 User-agent:baiduspider2 Disallow:/baidu3 Disallow:/s?4 Disallow:/ulink?5 Disallow:/link?6 Disallow:/home/news/data/7 8 User-agent:googlebot9 Disallow:/baiduTen Disallow:/s? One Disallow:/shifen/ A Disallow:/homepage/ - Disallow:/cpro - Disallow:/ulink? the Disallow:/link? - Disallow:/home/news/data/ -  - User-agent:msnbot + Disallow:/baidu - Disallow:/s? + Disallow:/shifen/ A Disallow:/homepage/ at Disallow:/cpro - Disallow:/ulink? - Disallow:/link? - Disallow:/home/news/data/ -  - User-agent:baiduspider-image in Disallow:/baidu - Disallow:/s? to Disallow:/shifen/ + Disallow:/homepage/ - Disallow:/cpro the Disallow:/ulink? * Disallow:/link? $ Disallow:/home/news/data/Panax Notoginseng  - User-agent:youdaobot the Disallow:/baidu + Disallow:/s? A Disallow:/shifen/ the Disallow:/homepage/ + Disallow:/cpro - Disallow:/ulink? $ Disallow:/link? $ Disallow:/home/news/data/ -  - User-agent:sogou Spider2 the Disallow:/baidu - Disallow:/s?Wuyi Disallow:/shifen/ the Disallow:/homepage/ - Disallow:/cpro Wu Disallow:/ulink? - Disallow:/link? About Disallow:/home/news/data/ $  - User-agent:sogou Blog - Disallow:/baidu - Disallow:/s? A Disallow:/shifen/ + Disallow:/homepage/ the Disallow:/cpro - Disallow:/ulink? $ Disallow:/link? the Disallow:/home/news/data/ the  the User-agent:sogou News Spider the Disallow:/baidu - Disallow:/s? in Disallow:/shifen/ the Disallow:/homepage/ the Disallow:/cpro About Disallow:/ulink? the Disallow:/link? the Disallow:/home/news/data/ the78user-agent: *Disallow:/

The meaning of the parameters in Robots.txt:

1. User-agent: Describe the name of the search engine spider. In the "robots.txt" file, if there are multiple user-agent records, there are multiple robot that are bound by the agreement. Therefore, there must be at least one user-agent record in the "robots.txt" file. If the value of the item is set to * (wildcard character), the protocol is valid for any search engine robot. In the "robots.txt" file, there can only be one record for "user-agent:*".

2. Disallow:/Forbidden Path

For example, Disallow:/home/news/data/, which represents a crawler that cannot access all URLs after/home/news/data/, but can access/home/news/data123

Disallow:/home/news/data, on behalf of the crawler can not access/home/news/data123,/HOME/NEWS/DATADASF, and a series of URLs beginning with data.

The former is precisely shielded and the latter is relatively shielded

3. allow:/Allowed access Path

For example, there are several paths, such as news, video, image, and so on, behind disallow:/home/

Then use Allow:/home/news, which represents all paths after the/home/is forbidden, but can access the/home/news path

robots.txt file for Web site

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.