Zend Server CE Apache mod_rewrite REQUEST_FILENAME SCRIPT_FILENAME 问题

发布于 2024-09-03 20:03:55 字数 671 浏览 4 评论 0原文

那里!我在项目中使用这个 .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_FILENAMEREQUEST_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 and REQUEST_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 of REQUEST_URI (which contains the value of the uri field of request_rec).

Anyone can figure out why? Appreciate!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

獨角戲 2024-09-10 20:03:55

对不起,大家!我犯了一个错误,这会起作用:

   `RewriteEngine On`
   `RewriteCond %{SCRIPT_FILENAME} !-f`
   `RewriteCond %{SCRIPT_FILENAME} !-d`
   `RewriteRule ^(.*)$ /index.php  [L]`

看来FastCGI将像index.php/anything_here这样的url处理为真正的url,而不是带有pathinfo的index.php。

Sorry,EveryOne! I made a mistake, this will work:

   `RewriteEngine On`
   `RewriteCond %{SCRIPT_FILENAME} !-f`
   `RewriteCond %{SCRIPT_FILENAME} !-d`
   `RewriteRule ^(.*)$ /index.php  [L]`

It appears that FastCGI process url like index.php/anything_here as a true url , not index.php with pathinfo.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文