"Robots.txt" is a regular text file that through its name, has special meaning to the majority of "honorable" robots on the web. By defining a few rules in this text file, you can instruct robots to not crawl and index certain files, directories within your site, or at all. For example, you may not want Google to crawl the /images directory of your site, as it's both meaningless to you and a waste of your site's bandwidth. "Robots.txt" lets you tell Google just that.
1) Here's a basic "robots.txt":
2) you may not want Google's Image bot crawling your site's images and making them searchable online, if just to save bandwidth. The below declaration will do the trick:
5) There is a way to use Disallow: to essentially turn it into "Allow all", and that is by not entering a value after the colon(:):
6) Finally, some crawlers now support an additional field called "Allow:", most notably, Google. As its name implies, "Allow:" lets you explicitly dictate what files/folders can be crawled. However, this field is currently not part of the "robots.txt" protocol, so use it only if absolutely needed, as it might confuse some less intelligent crawlers.
Per Google's FAQs for web-masters, the below is the preferred way to disallow all crawlers from your site EXCEPT Google:
1) Here's a basic "robots.txt":
User-agent: *With the above declared, all robots (indicated by "*") are instructed to not index any of your pages (indicated by "/"). Most likely not what you want, but you get the idea.
Disallow: /
2) you may not want Google's Image bot crawling your site's images and making them searchable online, if just to save bandwidth. The below declaration will do the trick:
User-agent: Googlebot-Image3) The following disallows all search engines and robots from crawling select directories and pages:
Disallow: /
User-agent: *4) You can conditionally target multiple robots in "robots.txt." Take a look at the below:
Disallow: /cgi-bin/
Disallow: /privatedir/
Disallow: /tutorials/blank.htm
User-agent: *This is interesting- here we declare that crawlers in general should not crawl any parts of our site, EXCEPT for Google, which is allowed to crawl the entire site apart from /cgi-bin/ and /privatedir/. So the rules of specificity apply, not inheritance.
Disallow: /
User-agent: Googlebot
Disallow: /cgi-bin/
Disallow: /privatedir/
5) There is a way to use Disallow: to essentially turn it into "Allow all", and that is by not entering a value after the colon(:):
User-agent: *Here all crawlers should be prohibited from crawling our site, except for Alexa, which is allowed.
Disallow: /
User-agent: ia_archiver
Disallow:
6) Finally, some crawlers now support an additional field called "Allow:", most notably, Google. As its name implies, "Allow:" lets you explicitly dictate what files/folders can be crawled. However, this field is currently not part of the "robots.txt" protocol, so use it only if absolutely needed, as it might confuse some less intelligent crawlers.
Per Google's FAQs for web-masters, the below is the preferred way to disallow all crawlers from your site EXCEPT Google:
User-agent: *Finally this file (robot.txt) must be uploaded to the root accessible directory of your site, not a subdirectory (eg. www.mysite.com/robot.txt) it is only by following the above rules will search engines interpret the instructions contained in the file.
Disallow: /
User-agent: Googlebot
Allow: /
4 comments:
Thanks for sharing your info. I really appreciate your efforts and I will be waiting for your further write ups thanks once again.
Thank you! very good article. Now I understand how robots.txt works :)
Typo that could cause confusion:
"5) There is a way to use Disallow: to essentially turn it into "Allow all", and that is by not entering a value after the semicolon(:):"
':' is a "colon" not a "semicolon". This is a semicolon ";"
thanks, this is fixed.
Post a Comment