We know that the search engine has its own "Search Robot" (Robots), and through these Robots on the network (generally HTTP and SRC link), you will continue to grab the data to establish your own database. For website managers and content providers, sometimes there are some sites, do not want to be disclosed by Robots. In order to solve this problem, two ways provide two ways: one is Robots.txt and the other is the Robots Meta tag.
First, Robots.txt
1, what is robots.txt?
Robots.txt is a plain text file that declares that the site does not want to be accessed by Robots in this file, so that some or all of the content of the site can be included in the search engine, or specifying the search engine only Content.
When a search robot accesses a site, it will first check if there is robots.txt in the root root of the site. If you find it, the search robot will determine the scope of the access by the content in this file. If the file does not exist, then Search Robots will be grabbed along the link.
Robots.txt must be placed under the root of a site, and the file name must be lowercase.
Website URL The corresponding Robots.txt's URL
http://www.w3.org/ http://www.w3.org/ Robots.txt http://www.w3.org:80/ http://www.w3.org:80/ robots.txt http://www.w3.org:1234/ http://www.w3.org:1234/ Robots.txt http://w3.org/ http://w3.org/ Robots.txt
2, robots.txt
The "robots.txt" file contains one or more records that are separated by the space line (with Cr, Cr / NL, or NL as the end value), each record format is as follows:
"
In this document, you can use # to annotate, specific usage methods, and practices in UNIX. Records in this file typically start with a row or multi-line User-Agent, and there are several Disallow lines, and the details are as follows:
User-agent:
The value of this item is used to describe the name of the search engine Robot. In the "robots.txt" file, if there are multiple User-Agent records, there are multiple Robot that will be subject to the limit, at least the file, at least There is a User-agent record. If the value of this item is *, the protocol is valid for any machine, in the "Robots.txt" file, "user-agent: *" records can only have one.
Disallow:
The value of this item is used to describe a URL that does not want to be accessed. This URL can be a complete path, or some, any URL starting with Disallow is not accessed by Robot. For example, "disallow: / help" does not allow search engine access to /Help.html and /Help/index.html, and "Disallow: / Help /" allows Robot to access /Help.html, not access / help / index .html.
Any disallow record is empty, indicating that all parts of the site allow access, in the "/ ROBOTS.TXT" file, at least one DisliW record. If "/Robots.txt" is an empty file, the site is open for all search engines Robot. Here are some of the basic usage of Robots.txt:
l Disable all search engines from accessing website: user-agent: * dispialow: /
l Allow all Robot to access user-agent: * disallow: or you can also build an empty file "/Robots.txt" file
l Support all the sections of all search engines to access the website (CGI-BIN, TMP, PRIVATE directory in the following example) User-agent: * dispialow: / cgi-bin / disallow: / tmp / disallow: / privat /
l Disable a search engine access (BADBOT in the following example) user-agent: BadbotdisAllow: /
l Only a search engine is allowed (Webcrawler in the following example) User-agent: WebcrawlerDiSAllow:
User-agent: * dispialow: /
3, common search engine robot ROBOTS name
Name Search Engine
Baiduspider http://www.baidu.com scooter http://www.Altavista.com ket aarchiver http://www.alexa.com Googlebot http://www.google.com fast-webcrawler http://www.Alltheweb .com slurp http://www.inktomi.com msnbot http://search.msn.com
4, Robots.txt Example
Below is a robots.txt of some famous sites:
http://www.cnn.com/robots.txt http://www.google.com/robots.txt http://www.ibm.com/robots.txt http://www.sun.com/robots .txt http://www.eachnet.com/robots.txt
5, common robots.txt errors
l Upside down the order: Error Write into User-Agent: * Dislow: Googlebot
The correct thing should be: user-agent: GoogleBotdisAllow: *
l Placing multiple prohibition orders in a row: For example, write to disallow: / css / / cgi-bin / / / images /
Correct should be disallow: / css / disallow: / cgi-bin / disallow: / images /
l There is a large number of spaces in front of the line, such as Disalow: / cgi-bin / despite the standard did not talk about this, but this way is easy.
l 404 Redirect to another page: When the Robot accesses many sites that do not set the Robots.txt file, they are redirected to another HTML page. At this time, Robot often handles this HTML page file in a way to process the Robots.txt file. Although there is no problem, it is best to put a blank robots.txt file in the site root directory.
l uses uppercase. For example, User-Agent: ExciteDisAllow: Although the standard is not caselated, the directory and file name should be lowercase: user-agent: GoogleBotdisAllow:
l There is only disallow in the syntax, no allow! The wrong way is: user-agent: baiduspider disallow: / john / allow: / jane / l Forgetting the slash / wrong write: user-agent: baiduspider disallow: CSS
Correct should be User-agent: Baiduspider DisliW: / CSS /
The following gadgets specifically check the validity of the robots.txt file:
http://www.searchengineworld.com/cgi-bin/robotcheck.cgi
Second, ROBOTS META label
1, what is a Robots Meta label
The robots.txt file is mainly to limit the search engine access to the entire site or directory, while the Robots Meta label is primarily for one specific page. As with other Meta tags (such as using language, page description, keywords, etc.), Robots Meta tags are also placed in the
head> of the page, specifically to tell the search engine Robot how to capture the page Content. Specific form is similar (see the black body portion):hEAD>
...
body>
html>
2, Robots Meta labeling:
There is no case in the Robots Meta tag, name = "robots" means all search engines, which can be written to Name = "baiduspider" for a specific search engine. The Content section has four command options: Index, NoIndex, Follow, NOFOLLOW, and Dances are separated.
The Index instruction tells the search robot to grab the page;
The FOLLOW instruction indicates that the search robot can continue to capture along the link on the page;
The default value for the Robots Meta tag is index and follow, except for INKTOMI, for it, default is index, nofollow.
In this way, there are four combinations:
among them
can be written
;
It should be noted that the above-mentioned Robots.txt and Robots Meta tags restricting the search engine robot's way to grab the site content is just a rule, and the cooperation of the engine robot is needed. It is not all Robots.
At present, the vast majority of search engine robots comply with Robots.txt rules, and for the Robots Meta label, there is not much support, but it is gradually increased, such as the famous search engine Google fully supports, and Google also increases. A directive "Archive" can limit whether Google retain web snapshots. E.g:
Represents to grab the page in this site and connect along the page, but not on GoolGe's web snapshot