【问题标题】:Setting Rewrite Rules for Zend Skeleton为 Zend Skeleton 设置重写规则
【发布时间】:2013-04-18 04:12:57
【问题描述】:

我使用的是 opensuse 12.2 操作系统、apache 2.2、zend 框架 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 错误。

【问题讨论】:

  • 添加vhost后是否重启了apache?

标签: apache .htaccess zend-framework2 virtualhost opensuse


【解决方案1】:

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

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-01-02
    • 2020-06-09
    • 2021-06-26
    • 2013-06-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多