codeigniter 防止系统文件夹和文件夹被索引
system文件夹、img文件夹、css文件夹和js文件夹中包含与网站内容无关的代码。我们应该在 robots.text 中禁止它们吗?
The system folder, img folder, css folder and js folder contain codes that unrelate to the content of the website. Should we disallow them in the robots.text ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
禁止使用
robots.txt
文件的目录意味着:robots.txt
只是对爬虫的指示 - 而绝对不是禁止任何人访问的方法。Disallowing directories using a
robots.txt
file means that :robots.txt
is just an indication to crawlers -- and absolutely not a way to forbid access to anyone.首先,它是
robots.txt
,而不是robots.text
。其次,CSS 文件和 JavaScript 无论如何都不会被索引,并且图像通常不会直接索引,它们在页面中找到时才会被索引,并且系统文件夹甚至不应该通过互联网访问。
最后,正如 Martin 所说,
robots.txt
文件只是对搜索引擎的推荐,它们不需要遵循它(尽管通常大搜索引擎会这样做)。First, it's
robots.txt
, notrobots.text
.Second, CSS files and Javascripts won't ever be indexed anyway, and images are usually not indexed directly, they are indexed when they are found in a page, and the system folder shouldn't even be accessible via the internet.
Finally, as Martin said, the
robots.txt
file is only a recommendation to search engines, they need not follow it (though typically the big ones do).默认情况下,用户无法访问 Codeigniter 中的系统文件夹,因此您不必担心这一点。
正如 Andrew 所写,img、css 和 js 文件夹的内容不会被搜索引擎索引,因此您也不用担心这一点。
但是,如果您有任何理由阻止搜索引擎访问上述文件的内容,您可以这样做,而不必担心您网站的排名和可见性会受到影响。
以下是 Google 给出的 SEO 建议:Seo Fact no。 19.。
By default, the system folder in Codeigniter is not accessible to the users so you should't worry about that.
Just as Andrew wrote, the contents of the img, css and js folders will not be indexed by search engines so you should't worry about that either.
However, if you have any reason to block the contents of the above files for the search engines, you can do that without any worries that your site's rankings and visibility will be affected by this.
Here's a SEO recommendation that Google gives: Seo Fact no. 19.