【发布时间】:2015-11-22 04:26:22
【问题描述】:
我客户的网站目前正在使用 mod_php 的 apache 服务器上运行。所有应用程序的路由都在 .htaccess 文件中定义(参见下面的代码)。现在他正在尝试迁移到运行 apache 和 php-fastcgi 的服务器,但路由不再有效。
<IfModule mod_rewrite.c>
RewriteEngine On
# Redirect
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule "^noticias/?$" index.php/noticias/frontend/list/ [L,QSA]
RewriteRule ^.*$ index.php [NC,L]
</IfModule>
当我访问http://domain.tld/noticias 时,我得到No input file specified,并且在apache error_log 中[fcgid:warn] mod_fcgid: stderr: PHP Warning: Unknown: function '1' not found or invalid function name in Unknown on line 0,但是如果我直接访问路由http://domain.tld/index.php/noticias/frontend/list/ 它工作正常。
更新
我找到了一个改变框架行为的可行解决方案。如果有人有解决方案而无需更改框架(可能在 apache 或 php 配置中),我会很乐意奖励答案。
【问题讨论】:
-
新服务器上是否安装了mod_rewrite?
-
@Pipe 是的,我运行了其他测试来检查这一点。
-
您使用的是哪个主机?
-
@Bugfixer 我们目前正在使用 EC2 实例
-
@LucasFerreira - 检查this