Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在父目录中我有 htaccess
<files error.php> Header add X-HeaderName "Header Value" </files>
父文件夹有一个名为的文件error.php和一个子文件夹,其中还包含一个名为error.php.
error.php
如何创建仅适用于父目录中文件的规则?
听起来您的 .htaccess 文件和您要引用的 error.php 位于同一目录中。如果是这样,你可以试试...
<files ./error.php> Header add X-HeaderName "Header Value" </files>
告诉 htaccess 使用当前目录中的文件,由 ./ 表示
我现在没有办法测试这个,但值得一试