- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我有一个 .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/
我有一个 .htaccess 规则,将对 /category/category-slug/ 的请求传递给 category.php。但是,当我检查 $_SERVER 超全局时,我得到了这个条目: Ar
当我注意到 $_SERVER['PATH_TRANSLATED'] 变量正在执行此操作时,我正在尝试创建 MVC 框架: [PATH_INFO] => /test/test2/test3 [PATH_
我是一名优秀的程序员,十分优秀!