![](/img/trans.png)
[英]In robots.txt only allow crawling for subdomain NOT subdirectory on shared hosting?
[英]Disable crawling for subdomain
我想禁用对子域的抓取。
例如:我的主域名是maindomain.com
subdomain_one.com(附加域名)
subdomain_two.com(附加域名)
所以我想禁用subdomain_one.maildomain.com的抓取功能。
我在robot.txt中使用过这个:
User-agent: *
Disallow: /subdomain_one/
Disallow: /subdomain_two/
该文件必须被称为robots.txt
,而不是robot.txt
。
如果您要禁止所有漫游器抓取您的子域,则必须在此子域的文档根目录中放置robots.txt文件,其中包含以下内容:
User-agent: *
Disallow: /
每个主机都需要自己的robots.txt
。 您无法在robots.txt中指定子域,只能指定URL路径的开头 。
因此,如果您要阻止http://sub.example.com/
上的所有文件,则必须可以从http://sub.example.com/robots.txt
访问robots.txt。
无论您的网站在服务器端的组织方式如何,唯一重要的是可公开访问的内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.