2013-04-24 52 views
1

我使用的是opensuse 12.2 os,apache 2.2,zend framework 2. 为了让框架的骨架应用程序在apache的文件中设置一个虚拟主机。 这里是定义为Zend Skeleton设置重写规则

<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的错误错误。

+0

您是否在添加虚拟主机后重新启动apache? – Crisp 2013-04-24 14:42:25

回答

0

你已经得到了你的VHOST设置incrrectly对于初学者:

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

你已经得到覆盖掉,这会杀了你的htaccess。

+0

非常感谢。 – user1828958 2013-04-24 18:11:26