虽然为索引页面工作,但在zend框架中找不到url

Roh*_*are 1 zend-framework

我正在尝试使用zend框架开发网站,所以我创建了一个index.php文件,我的所有请求都去了,c.reated两个控制器一个是IndexController,另一个是TestController

Class IndexController extends Zend_Controller_Action{
    public function indexAction(){
        echo "Index Index Jamla";
    }
    public function displayAction(){
        echo "Index Display Jamla";
    }
}
Run Code Online (Sandbox Code Playgroud)

现在,当我访问url http:// test / 它正确调用IndexController及其IndexAction函数但是当我访问url http:// test/index/index时, 它显示在此服务器上找不到消息url/index/index与我访问http:// test/test/index时相同

虽然http:// test /等同于http:// test/index/index

dre*_*010 5

Zend Framework的重写规则不起作用.

http://test因为Apache默认运行index.php会运行你的应用程序.路由器将看不到URL参数,因此它将路由到索引控制器索引操作.当您尝试访问其他任何内容时,Apache正在处理该请求,并且不会将其重写为index.php,因此您找不到404.

确保包含重写规则的.htaccess位于公用文件夹中.还要检查Apache是​​否允许通过AllowOverride All在httpd.conf和/或httpd-vhosts.conf中设置来处理文档根目录的.htaccess文件.