【问题标题】:What's the meaning of the slash in the end of disallow path?禁止路径末尾的斜杠是什么意思?
【发布时间】:2019-01-17 19:25:03
【问题描述】:

robots.txt 文件中有两行:

Disallow: /messages
Disallow: /qanda/edit/

这个/messages 指向什么路径?那么/qanda/edit/ 呢?第二条路径末尾的/ 没用吗?还是有特定的含义?


或者让我这样问:论文的确切含义是什么?

Disallow: /messages
Disallow: /messages/

【问题讨论】:

    标签: url path seo robots.txt slash


    【解决方案1】:

    Disallow 值表示 URL 路径的开头。

    Disallow: /messages

    会阻止这样的 URL:

    https://example.com/messages
    https://example.com/messages.html
    https://example.com/messages/
    https://example.com/messages/foo
    

    Disallow: /messages/

    会阻止这样的 URL:

    https://example.com/messages/
    https://example.com/messages/foo
    

    但允许使用以下网址:

    https://example.com/messages
    https://example.com/messages.html
    

    【讨论】:

      【解决方案2】:

      如果你想禁止消息目录中的所有内容,我认为你必须在末尾添加斜线

      Disallow: /messages/
      

      如果你不把“/”放在最后,例如可以是/messages.html

      Disallow : /messages
      

      好像

      Disallow : /message*
      

      【讨论】:

      猜你喜欢
      • 2022-11-01
      • 1970-01-01
      • 2021-06-15
      • 2012-05-07
      • 2013-10-24
      • 2022-01-17
      • 2012-10-31
      • 1970-01-01
      相关资源
      最近更新 更多