Zend framework ZendFrameWork mod_rewrite已启用,但URL仍不工作-wampserver 2.1?

Zend framework ZendFrameWork mod_rewrite已启用,但URL仍不工作-wampserver 2.1?,zend-framework,wampserver,Zend Framework,Wampserver,我已启用mod_rewrite,并在httpd.conf中具有以下内容: <Directory /> Options FollowSymLinks AllowOverride all Order allow,deny Allow from all </Directory> 选项如下符号链接 允许超越所有 命令允许,拒绝 通融 我已经设置了一个别名,指向项目127.0.0.1/whatford中的公用文件夹/ 但是我仍然必须在url前面加上index.

我已启用mod_rewrite,并在httpd.conf中具有以下内容:

<Directory />
  Options FollowSymLinks
  AllowOverride all
  Order allow,deny
  Allow from all
</Directory>

选项如下符号链接
允许超越所有
命令允许,拒绝
通融
我已经设置了一个别名,指向项目127.0.0.1/whatford中的公用文件夹/

但是我仍然必须在url前面加上index.php以访问其他控制器/视图示例=127.0.0.1/whatford/index.php/contact-而不是127.0.0.1/whatford/contact


任何帮助都将不胜感激,谢谢我使用这个:
$\u服务器[“REQUEST\u URI”]=str\u replace('index.php','',$\u服务器[“REQUEST\u URI”])
添加到my index.php的顶部,以删除url中的index.php


另外,请查看此内容,在这篇文章之后,您可以确保您的apache设置对于ZF是正确的,即使您没有设置完整的Vhost。

我使用以下内容:
$\u SERVER[“REQUEST\u URI”]=str\u replace('index.php','',$\u SERVER[“REQUEST\u URI”)
添加到my index.php的顶部,以删除url中的index.php


另外,请查看此内容,在本文之后,您可以确保您的apache设置对于ZF是正确的,即使您没有设置完整的Vhost。

尝试使用Vhost

以下是您可以基于域名test.local尝试的设置

因此,如果您正在使用Windows update C:\Windows\System32\drivers\etc\hosts,请添加如下域:

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
    127.0.0.1       localhost 
    127.0.0.1       test.local
Include conf/extra/httpd-vhosts.conf
如果您在Windows下使用Apache,请像这样更新httpd-vhosts.conf文件(确保在DocumentRoot和Directory下输入了正确的文件夹名):

Apache httpd.conf文件中的第行,看起来如下所示:

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
    127.0.0.1       localhost 
    127.0.0.1       test.local
Include conf/extra/httpd-vhosts.conf
然后重新启动Apache并转到,您应该有您的起始页

让我知道这是否对你有效,或者如果你遇到更多的问题

干杯


Dave

尝试与vhost一起工作

以下是您可以基于域名test.local尝试的设置

因此,如果您正在使用Windows update C:\Windows\System32\drivers\etc\hosts,请添加如下域:

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
    127.0.0.1       localhost 
    127.0.0.1       test.local
Include conf/extra/httpd-vhosts.conf
如果您在Windows下使用Apache,请像这样更新httpd-vhosts.conf文件(确保在DocumentRoot和Directory下输入了正确的文件夹名):

Apache httpd.conf文件中的第行,看起来如下所示:

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
    127.0.0.1       localhost 
    127.0.0.1       test.local
Include conf/extra/httpd-vhosts.conf
然后重新启动Apache并转到,您应该有您的起始页

让我知道这是否对你有效,或者如果你遇到更多的问题

干杯


戴夫

你是在说甚高频吗?你是在说甚高频吗?谢谢你的回答,我使用了戴夫·克拉克的方法,现在正在使用。。。谢谢你的回答,我用了戴夫·克拉克的方法,现在已经奏效了。。。非常感谢