Zend Framework: The requested URL /newposter was not found on this server.

Problem:PHP zend framework The requested URL /XXX/public/index was not found on this server 

把根目录指向zend framework中的public目录,因为没有view,直接用Debug Url调试controller和action,一直报“Zend The requested URL /newposter was not found on this server.”这样的错误。

1、首先确定了我的VirtualHost"iphone.com"能够使用。

2、在Controller里面确实存在该action。

3、在httpd-vhosts.conf文件中虚拟主机iphone.com开启了“AllowOverride All”,允许所有具有".htaccess"作用域的指令都允许出现在.htaccess文件中。

4、httpd-vhosts.conf通过在httpd.conf中的“Inlcude /extra/httpd-vhosts.conf”选线启用,打开httpd.conf文件可以发现下面的AllowOverride的选项。

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "D:\Program Files\Zend\Apache2/htdocs">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks
    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None
    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all
</Directory>

中的AllowOverride为None,直接改为All,重启Appache服务器,能正常访问页面。

参考资料:百度百科--AllowOverride:http://baike.baidu.com/view/9411222.htm

你可能感兴趣的:(apache,服务器,framework,Zend,virtualhost,.htaccess)