我需要禁止索引2页,其中动态之一:结果 site.com/news.php结果 site.com/news.php?id=__结果 site.com/news-all.php

我应该写在robots.txt的:

User-agent: *  
Disallow: /news 

Disallow: /news* 

Disallow: /news.php*  
Disallow: /news-all.php 

如果一个使用通配符到底或不?

有帮助吗?

解决方案

robots.txt中的允许和禁止线说,“允许(或不允许)任何开头”。

所以:

Disallow: /news.php

是相同的

Disallow: /news.php*

提供,当然,该机器人的robots.txt阅读理解通配符。如果机器人不理解通配符,那么它将把星号作为实际文件名的一部分。

在该行的末端的星号是多余的,有潜在危险的。

其他提示

User-agent: *
Disallow: /news.php?id=*

User-agent: *
Disallow: /news-all.php

更多信息这里

修改

的第一条规则将允许与参数news.php但允许news.php没有?ID = __。如果你不想爬,你必须使用/news.php news.php *

有关确定

Disallow: /news.php
Disallow: /news-all.php

是否正确。 如果你有完整的文件名是不需要明星。 这是有趣的,虽然我wheather的

Disallow: /news*

方法能够工作。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top