如果我只允许爬虫访问index.php,这行得通吗?

User-agent: *
Disallow: /
Allow: /index.php

最佳答案

是的,它将起作用。这是Google Webmaster Tool的测试结果。

Url
http://www.example.org/index.php

Googlebot
Allowed by line 3: Allow: /index.php

Googlebot-Mobile
Allowed by line 3: Allow: /index.php

但是,请记住,使用此配置,除非使用完整的限定路径访问页面,否则不会抓取您的网站主页。
换句话说,http://www.example.org/被禁止,而http://www.example.org/index.php被允许。

如果您希望访问主页,这是文件的更好版本。
User-agent: *
Disallow: /
Allow: /index.php
Allow: /$

关于seo - 如何使用robots.txt允许抓取工具仅访问index.php?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/1637620/

10-13 01:31
查看更多