robots.txt 和 .htaccess 中的 Mod 重写

发布于 2024-09-25 17:26:15 字数 376 浏览 1 评论 0原文

在 robots.txt 文件中,我将禁止网站的某些部分。

例如,我不希望我的“条款和条件”被搜索引擎索引。

 User-agent: *
 Disallow: /terms

该文件的真实路径实际上是

 /data/terms_and_conditions.html

但我已经使用 .htaccess 重写了 URL。

现在问我的问题,我应该在 robots.txt 中指定重写的 url 还是实际的 url?

后续问题:我是否也需要有一个“允许”行,或者搜索引擎会假设所有其他不在 robots.txt 文件中的内容都是允许的吗?

谢谢

In the robots.txt file, I am about to disallow some sections of my site.

For instance, I don't want my "terms and conditions" to be indexed by search engines.

 User-agent: *
 Disallow: /terms

The real path to the file is actually

 /data/terms_and_conditions.html

But I have used .htaccess to rewrite the URL.

Now to my Q, should I specify the rewritten url in the robots.txt or the actual url?

Follow-up question: Do I need to have an "allow" line too, or will the search engines assume all other is allowed which isn't in the robots.txt file?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

绮烟 2024-10-02 17:26:15

搜索引擎将假定 robots.txt 中未包含的所有其他内容都是允许的。在你的情况下,它将禁止路径 /term。

Search engines will assume that all other is allowed which isn't in the robots.txt. In your case it will disallow path /term.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文