Kun*_* S. 6 seo shared-hosting search-engine robots.txt cpanel
我希望我的网站在搜索引擎中被编入索引,除了少数子目录.以下是我的robots.txt设置:
robots.txt 在根目录中
User-agent: *
Allow: /
Run Code Online (Sandbox Code Playgroud)
robots.txt在子目录中分开(要排除)
User-agent: *
Disallow: /
Run Code Online (Sandbox Code Playgroud)
它是正确的方式还是根目录规则将覆盖子目录规则?
不,这是错的.
您不能在子目录中拥有robots.txt.您的robots.txt 必须放在主机的文档根目录中.
如果您要禁止抓取路径开头的网址,请/foo在robots.txt(http://example.com/robots.txt)中使用此记录:
User-agent: *
Disallow: /foo
Run Code Online (Sandbox Code Playgroud)
这允许抓取所有内容(因此没有必要Allow),除了像
http://example.com/foohttp://example.com/foo/http://example.com/foo.htmlhttp://example.com/foobarhttp://example.com/foo/bar