阻止谷歌(搜索引擎)索引我的codeigniter网站的特定视图

时间:2014-03-24 16:44:39

标签: codeigniter robots.txt codeigniter-url

我在robots.text中使用了以下文字,该文件位于我网站的根目前,目的是隐藏google中的view.php。

User-agent: *
Disallow: /application/views/view.php

我这样做是否正确,或者我必须像下面那样编写控制器路径

User-agent: *
Disallow: /index.php/mycontroller/function

2 个答案:

答案 0 :(得分:0)

您需要引用网址,而不是文件的路径。所以在你的情况下,正确的方法是

User-agent: *
Disallow: /index.php/mycontroller/function

答案 1 :(得分:0)

是的,Pattle对URL的引用是正确的,因为文件夹通常不会直接编入索引,当它们在页面中找到时会被编入索引,而应用程序文件夹甚至不应该被编入索引。可通过浏览器/互联网访问所以竖起大拇指:

User-agent: *
Disallow: /index.php/mycontroller/function
Disallow: /mycontroller/function

如果您从 config.php 文件中删除 " index.php"