什么是重定向://在PATH_TRANSLATED? [英] What is redirect:// in PATH_TRANSLATED?

查看:1072
本文介绍了什么是重定向://在PATH_TRANSLATED?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个的.htaccess 规则,通行证的 /分类/类别的塞/ 要求 category.php 。然而,当我检查 $ _ SERVER 超级全局,我得到这个条目:

I have a .htaccess rule that passes requests for /category/category-slug/ to category.php. However, when I inspect the $_SERVER super-global, I get this entry:

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

那是什么?我从来没有见过的重定向:// 之前

这是初步认识的的.htaccess 的规则:

This is the relavant .htaccess rule:

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

这样一来,我没有收到 $ _ GET ['猫'] $ _ GET ['页'] 在我的脚本填充,因为它似乎从一个重定向现身,并没有要求是简单地重新编写。这是怎么回事?

As a result, I’m not getting $_GET['cat'] or $_GET['page'] populated in my script as it seems to be coming from a redirect and not having the request being simply re-written. What’s going on?

推荐答案

我发现的 Apache的错误报告(40781)什么似乎是同样的问题。由鲍勃·约内斯库引用评论:

I found an Apache bug report (40781) about what seems to be the same issue. To quote the comment by Bob Ionescu:

问题是,与URI =主请求PATH_INFO的子请求(为了获得PATH_TRANSLATED,即PATH_INFO的物理路径视图)射门击中重写规则在每个目录范围内一次比赛,因此没有物理路径。

"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.

为什么这不是在Apache 2.0中出现?答案很简单:mod_rewrite的不子请求在每个目录范围内2.1版本之前采取行动。该NS标志prevents在子请求的RewriteRules的处理。

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] 重写规则 s标志,除非你明确的希望它们应用到子请求了。

The comment suggests that you should be able to fix this issue by including the [NS] flag in your RewriteRules, unless you explicitly want them to apply to subrequests too.

这篇关于什么是重定向://在PATH_TRANSLATED?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆