Zend Server CE Apache mod_rewrite REQUEST_FILENAME SCRIPT_FILENAME 问题
那里!我在项目中使用这个 .htaccess 文件:
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
它在 Apache 2.2 中运行良好
最近我开始使用 Zend Server CE,重写规则不起作用! 这是可行的:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
这是 Apache 的文档所说的:
变量
SCRIPT_FILENAME
和REQUEST_FILENAME
包含相同的值 - Apache 服务器内部 request_rec 结构的 filename 字段的值。第一个名称是众所周知的 CGI 变量名称,而第二个名称是REQUEST_URI
的相应对应项(其中包含 request_rec 的 uri 字段的值)。
任何人都可以弄清楚为什么吗?欣赏!
there! I use this .htaccess file in a project:
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
It works well in Apache 2.2
Recently I started to use Zend Server CE , the ReWrite Rule didn't work !
And this works:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
This is what Apache's document say:
The variables
SCRIPT_FILENAME
andREQUEST_FILENAME
contain the same value - the value of the filename field of the internal request_rec structure of the Apache server. The first name is the commonly known CGI variable name while the second is the appropriate counterpart ofREQUEST_URI
(which contains the value of the uri field of request_rec).
Anyone can figure out why? Appreciate!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对不起,大家!我犯了一个错误,这会起作用:
看来FastCGI将像index.php/anything_here这样的url处理为真正的url,而不是带有pathinfo的index.php。
Sorry,EveryOne! I made a mistake, this will work:
It appears that FastCGI process url like index.php/anything_here as a true url , not index.php with pathinfo.