Zend - 模块结构无法正常工作

时间:2011-04-11 10:31:22

标签: zend-framework

我试图让我的应用程序模块结构但有问题......我的应用程序有本地地址“myapp”并链接到“C:/ www / myapp / public”(Windows)。当我尝试访问http://myapp(基于虚拟主机的地址)时,我会执行默认模块(模块:默认,控制器:索引,操作:索引)。但是当我尝试打开http://myapp/defaulthttp://myapp/faxes时,我获得了404浏览器页面(而不是Zend异常)。我做错了什么?
这是我的项目结构: structure

这是我缩短的application.ini:

[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
phpSettings.upload_tmp_dir = APPLICATION_PATH "/../data/tmp"

bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"

appnamespace = "Application"

resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"

resources.frontController.params.displayExceptions = 0
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.frontController.env = APPLICATION_ENV
resources.modules[] =
resources.layout.layoutPath = APPLICATION_PATH "/layouts"
resources.layout.viewSuffix = "phtml"
resources.layout.layout = "index"
resources.view.titleSeparator = " - "
resources.view.doctype = "XHTML1_STRICT"
resources.view.contentType = "text/html; charset=utf-8"
resources.view.encoding = "utf-8"
resources.view.ViewSuffix = "phtml"
resources.session.save_path = APPLICATION_PATH "/../data/session"

pluginPaths.Duck_Application_Resource = LIBRARY_PATH "/Duck/Application/Resource"

autoloaderNamespaces[] = "Duck"

1 个答案:

答案 0 :(得分:2)

我将假设你使用Apache作为你的网络服务器。

问题可能在于您的public / .htaccess文件。文件内容应类似于以下内容:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

如果您的htaccess中已经存在这些规则,那么您可能需要检查您的Web服务器配置文件(例如httpd.conf)是否包含以下内容:

AccessFileName .htaccess
AllowOverride all

上述文档可在Apache Core Features页面上找到。如果您仍遇到问题,请确保已正确安装和配置mod_rewrite Apache模块。