在 robots.txt 中,仅允许抓取共享主机上的子域而不是子目录?
我刚刚更改了 DNS 设置,因此文件夹 /forum
现在是子域而不是子目录。如果我创建一个 robots.txt 文件并说:
User-agent: *
Disallow: /forum
这会禁止对子目录和子域进行爬网吗?
我想禁止爬行子目录,但允许爬行子域。 注意:这是在共享主机上,因此子目录和子域都可以访问。这就是我有这个问题的原因。
那么,如何只允许对子域进行抓取?
I just changed the DNS settings so the folder /forum
is now a subdomain instead of a subdirectory. If I do a robots.txt file and say:
User-agent: *
Disallow: /forum
Will that disallow crawling for the subdirectory AND subdomain?
I want to disallow crawling of the subdirectory, but ALLOW crawling of the subdomain. Note: this is on shared hosting so both the subdirectory and subdomain can be visited. This is why I have this issue.
So, How can I only permit crawling for the subdomain?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果你想停止爬行,这是正确的方法。但请注意:如果 URL 已被索引,则不会被删除。
我更喜欢的方法是通过元标记将所有页面设置为“noindex/follow”,或者更好的是“规范标记”将搜索引擎流量发送到子域网址
进入您的
在给定的 URL(例如“http://www.yourdomain.com/directoryname/post-of-the-day”)上使用
最新的 URL 将是 SERP 中唯一的 URL
It's the correct way, if you want to stop crawling. But note: If the URLs are already indexed, the won't be removed.
The way I would prefer is to set all pages to "noindex/follow" via meta tags or even better you the "canonical tag" to send the search engines traffic to the subdomain url
Into your
On a given URL like "http://www.yourdomain.com/directoryname/post-of-the-day" use
The latest URL will be the only one in SERPs