首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >"Disallow: /test/programmming“还是"Disallow: /programming"?

"Disallow: /test/programmming“还是"Disallow: /programming"?
EN

Stack Overflow用户
提问于 2019-03-06 22:57:11
回答 1查看 50关注 0票数 0

我在WordPress下管理一个网站。我们不得不将网站的网址改为example.com/test。因此,我现在在搜索控制台中有两个属性:一个是根域(example.com)。另一个包含子目录(example.com/test)。

每当我在谷歌中搜索site:example.com时,它都会返回主页的所有可索引URL,即example.com/test。因此,域根example.com不再是可索引的。

在robots.txt中,我喜欢禁止某些URL,比如example.com/test/programming

我应该禁止:/programming还是不允许:/test/programmming,这样example.com/test/programming就会被阻塞?

EN

回答 1

Stack Overflow用户

发布于 2019-03-08 02:24:34

URL值始终表示Disallow路径的开头。

对于https://example.com/test/programming,路径为/test/programming

因此,Disallow: /test/programming会像这样阻止URL:

  • https://example.com/test/programming
  • https://example.com/test/programming/
  • https://example.com/test/programming.html
  • https://example.com/test/programming/foo/bar

Disallow: /programming会像这样阻止URL:

  • https://example.com/programming
  • https://example.com/programming/
  • https://example.com/programming.html
  • https://example.com/programming/foo/bar
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55026034

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档