【发布时间】: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