gpt4 book ai didi

php - 什么是重定向 ://in PATH_TRANSLATED?

转载 作者:可可西里 更新时间:2023-11-01 01:04:39 25 4
gpt4 key购买 nike

我有一个 .htaccess 规则,将对 /category/category-slug/ 的请求传递给 category.php。但是,当我检查 $_SERVER 超全局时,我得到了这个条目:

Array
(
[PATH_TRANSLATED] => redirect://
)

那是什么?我以前从未见过 redirect://

这是相关的 .htaccess 规则:

RewriteRule ^category/([^/]+)/?(.*) /category.php?cat=$1&page=$2 [L,QSA]

因此,我的脚本中似乎没有填充 $_GET['cat']$_GET['page']来自重定向并且没有简单地重写请求。怎么回事?

最佳答案

我找到了一个 Apache bug report (40781)关于什么似乎是同一个问题。引用comment by Bob Ionescu :

"The problem is that the subrequest with uri=path_info of the main request (in order to obtain path_translated, i.e. the physical path view of path_info) hits the RewriteRule in per-directory context again and matches; hence no physical path.

Why does this not occur in Apache 2.0? The answer is simple: mod_rewrite doesn't act in subrequests in per-directory context prior version 2.1. The NS flag prevents the processing of RewriteRules in subrequests."

评论表明您应该能够通过包含 [NS] flag 来解决此问题在您的 RewriteRule 中,除非您明确希望它们也适用于子请求。

关于php - 什么是重定向 ://in PATH_TRANSLATED?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14113593/

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