使用robots.txt

1.允许所有的robot访问

User-agent: *
Disallow:

2.禁止所有搜索引擎访问网站的任何部分

User-agent: *
Disallow: /

3.禁止所有搜索引擎访问网站的几个部分(下例中的order、member、product目录)

User-agent: *
Disallow: /order/
Disallow: /member/
Disallow: /product/

4.禁止某个搜索引擎的访问(下例中的Google)

User-agent: Googlebot
Disallow: /

5.只允许某个搜索引擎的访问(下例中的Google)

User-agent: Googlebot
Disallow:

User-agent: *
Disallow: /

6.使用 robots.txt 文件拦截或删除整个网站

User-agent: *

Disallow: /

7.要只从 Google 中删除您的网站,并只是防止 Googlebot 将来抓取您的网站,请将以下 robots.txt 文件放入您服务器的根目录

User-agent: Googlebot

Disallow: /

8.如何放置Robots.txt文件

robots.txt自身是一个文本文件。它必须位于域名的根目录中并 被命名为"robots.txt"。位于子目录中的 robots.txt 文件无效,因为漫游器只在域名的根目录中查找此文件。例如,http://www.example.com/robots.txt 是有效位置,http://www.example.com/mysite/robots.txt 则不是。

引用Google的规则说明

这里写图片描述

发布了31 篇原创文章 · 获赞 15 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/dongdingzhuo/article/details/79542919