Apache 防止googlebot索引robots.txt和.htaccess中的文件类型

Apache 防止googlebot索引robots.txt和.htaccess中的文件类型,apache,.htaccess,robots.txt,googlebot,Apache,.htaccess,Robots.txt,Googlebot,关于如何防止GoogleBot索引,例如,txt文件,存在许多堆栈溢出问题。这是: robots.txt User-agent: Googlebot Disallow: /*.txt$ .htaccess <Files ~ "\.txt$"> Header set X-Robots-Tag "noindex, nofollow" </Files> 标题集X-Robots-Tag“noindex,nofollow” 但是,当试图阻止对两种类型的文件编制索引

关于如何防止GoogleBot索引,例如,
txt
文件,存在许多堆栈溢出问题。这是:

robots.txt

User-agent: Googlebot Disallow: /*.txt$
.htaccess

<Files ~ "\.txt$">
     Header set X-Robots-Tag "noindex, nofollow"
</Files>

标题集X-Robots-Tag“noindex,nofollow”

但是,当试图阻止对两种类型的文件编制索引时,这两种文件的语法是什么?在我的例子中-
txt
doc

在robots.txt文件中:

User-agent: Googlebot
Disallow: /*.txt$
Disallow: /*.doc$
更多详细信息,请访问谷歌网站管理员:


在.htaccess文件中:

<FilesMatch "\.(txt|doc)$">
    Header set X-Robots-Tag "noindex, nofollow"
</FilesMatch>

标题集X-Robots-Tag“noindex,nofollow”

更多详情请点击此处:

谢谢。顺便问一下,为什么我举的例子说
,而你的例子说
都是Apache指令。您可以在此处看到定义: