gpt4 book ai didi

Apache RewriteRule,-(破折号)作为替换

转载 作者:行者123 更新时间:2023-12-03 00:20:05 30 4
gpt4 key购买 nike

我经常在 PHP MVC 应用程序中看到 Apache RewriteRule,如下所示:

RewriteRule ^.*$ - [NC,L]

Apache docs for the RewriteRule directive状态:

A dash indicates that no substitutionshould be performed (the existing pathis passed through untouched). This isused when a flag (see below) needs tobe applied without changing the path.

因此,根据我收集的信息,您可以使用它来使用标志(即 [NC])来转换路径,以供 RewriteRule 遵循?

有人可以更好地解释一下这个破折号RewriteRule吗?

最佳答案

请参阅此答案:

mod_rewrite: what does this RewriteRule do?

它本质上意味着“如果之前的 RewriteConds 匹配,则不执行任何操作”。当 RewriteConds 不匹配时,下一个 RewriteRule 将执行其他操作。就我链接到的帖子而言,下一个 RewriteRule 会重写包含“index.php”的 url。

关于Apache RewriteRule,-(破折号)作为替换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4350597/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com