【发布时间】:2011-01-16 18:21:32
【问题描述】:
当我注意到 $_SERVER['PATH_TRANSLATED'] 变量正在这样做时,我正在尝试创建 MVC 框架:
[PATH_INFO] => /test/test2/test3
[PATH_TRANSLATED] => 重定向:/index.php/test/test2/test3/test2/test3
这是当我通过http://domain.tld/test/test2/test3访问PHP文件时
注意 /test/ 之后它是如何重复的
这是我用于重写的 .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
有什么想法吗?我尝试更改 RewriteRule 规则,但没有任何改变。该变量对于我想要做的事情并不重要,但是我想知道为什么会发生这种情况以及我是否有错误配置。
服务器信息:
Apache/2.2.3
PHP 5.3.1
编辑:该变量在 Lighttpd 下不会重复,因为它报告:
[PATH_INFO] => /test/test2/test3
[PATH_TRANSLATED] => /home/kramer/public_html/test/test2/test3
所以我假设它与 Apache 有关。我还在 Apache 下尝试了 FastCGI,它产生了相同的重复结果。
【问题讨论】:
标签: php apache mod-rewrite apache2