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

时间:2012-01-12 16:22:46

标签: 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";
    }
}

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

虽然http://test/相当于http://test/index/index

3 个答案:

答案 0 :(得分:5)

Zend Framework的重写规则无效。

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

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

答案 1 :(得分:0)

确保在Apache配置中将AllowOverride设置为All并启用了mod_rewrite扩展

答案 2 :(得分:0)

傻但你可以再次重新检查在views / scripts / index /

下是否存在index.phtml文件
相关问题