1

我使用opensuse 12.2 os、apache 2.2、zend framework 2。为了拥有框架的骨架应用程序,我在apache的文件中设置了一个虚拟主机。这是定义

   <VirtualHost 127.0.0.1>
       DocumentRoot "/home/gabriele/Web/zf2-tutorial/public/"
       ServerName zf2-tutorial.localhost
       SetEnv APPLICATION_ENV "development" 
       <Directory "/home/gabriele/Web/zf2-tutorial/public/">
             Options +FollowSymLinks
             AllowOverride All
             DirectoryIndex index.php 
             AllowOverride None
             Order allow,deny
             Allow from all
       </Directory>
   </VirtualHost>

当我移动到 zf2-tutorial.localhost 时,我可以看到欢迎页面。我试过htaccess

     Options +FollowSymlinks
     RewriteEngine On
     # The following rule tells Apache that if the requested filename
     # exists, simply serve it.
     RewriteCond %{REQUEST_FILENAME} -s [OR]
     RewriteCond %{REQUEST_FILENAME} -l [OR]
     RewriteCond %{REQUEST_FILENAME} -d
     RewriteRule ^.*$ - [NC,L]
     RewriteRule ^.*$ index.php [NC,L]

     The structure of my folder is :
     \home
           \gabriele 
                    \Web
                         \zf2-tutorial
                                     \public
                                            -index.php
                                            -htaccess

如果我继续 zf2-tutorial.localhost/test1234 我应该看到一个错误重定向到骨架内,而不是我看到一个正常的 apache 错误。

4

1 回答 1

0

您已经为初学者正确设置了 VHOST:

  AllowOverride All
  DirectoryIndex index.php 
  AllowOverride None # WRONG - remove this.

您已经关闭了 Overrides,这将杀死您的 htaccess。

于 2013-04-24T14:49:30.613 回答