【问题标题】:backwards or forwards slash in files match .htaccess文件中的反斜杠或正斜杠匹配 .htaccess
【发布时间】:2014-01-30 21:02:28
【问题描述】:

考虑到我找不到针对目录中文件的 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>

【问题讨论】:

    标签: .htaccess mod-headers


    【解决方案1】:

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

    所以正确的是:

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

    【讨论】:

      猜你喜欢
      • 2013-07-23
      • 1970-01-01
      • 2013-11-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-14
      • 2021-12-31
      • 1970-01-01
      相关资源
      最近更新 更多