在文件中向后或向前斜杠匹配.htaccess

时间:2014-01-30 21:02:28

标签: .htaccess mod-headers

我不确定以下内容是否正确,因为我找不到针对目录中文件的Web示例。

<FilesMatch "/out/index.php$">
Header set X-Robots-Tag "noindex, nofollow"
</FilesMatch>

这样就可以了:

<FilesMatch "\out\index.php$">
Header set X-Robots-Tag "noindex, nofollow"
</FilesMatch>

1 个答案:

答案 0 :(得分:2)

第一个是正确的,因为像Unix系统这样的Apache使用路径的正斜杠。

所以正确的是:

<FilesMatch "/out/index\.php$">
    Header set X-Robots-Tag "noindex, nofollow"
</FilesMatch>