User-agent: Googlebot
Disallow: /
每个端口都应有自己的 robots.txt 文件。尤其是您通过 http 和 https 托管内容的时候,这些协议都需要有各自的 robots.txt 文件。例如,要让 Googlebot 只为所有的http网页而不为https 网页编制索引,应使用下面的 robots.txt 文件。
对于 http 协议 (http://bggoogle.com/robots.txt):
User-agent: *
Allow: /
对于 https 协议 (https://bggoogle.com/robots.txt):
User-agent: *
Disallow: /
允许所有的漫游器访问您的网页
User-agent: *
Disallow:
(另一种方法: 建立一个空的 "/robots.txt" 文件, 或者不使用robot.txt。)
使用 robots.txt 文件拦截或删除网页 您可以使用 robots.txt 文件来阻止 Googlebot 抓取您网站上的网页。 例如,如果您正在手动创建 robots.txt 文件以阻止 Googlebot 抓取某一特定目录下(例如,private)的所有网页, 可使用以下 robots.txt 条目:
User-agent: Googlebot
Disallow: /private
要阻止 Googlebot 抓取特定文件类型(例如,.gif)的所有文件,可使用以下 robots.txt 条目:
User-agent: Googlebot
Disallow: /*.gif$
要阻止 Googlebot 抓取所有包含 ? 的网址(具体地说,这种网址以您的域名开头,后接任意字符串,然后是问号,而后又是任意字符串),可使用以下条目:
User-agent: Googlebot
Disallow: /*?
尽管我们不抓取被 robots.txt 拦截的网页内容或为其编制索引,但如果我们在网络上的其他网页中发现这些内容,我们仍然会抓取其网址并编制索引。因此,网页网址及其他公开的信息,例如指 向该网站的链接中的定位文字,有可能会出现在 Google 搜索结果中。不过,您网页上的内容不会被抓取、编制索引和显示。