ServerName不工作Zend框架2

时间:2015-02-11 11:12:56

标签: php zend-framework2 localhost

我在我的系统上安装了xampp和Zend framework 2。当我运行代码发送框架工作正常。 D:/ xampp / htdocs / CommunicationApp / public其工作正常显示

恭喜!您已成功安装ZF2 Skeleton Application。您目前正在运行Zend Framework 2.3.4版。这个框架可以作为您在ZF2上开始构建应用程序的简单起点。 但是当我在浏览器中运行Server name时显示xampp localhost页面。请帮我 服务器名称我创建:

<VirtualHost *:80>
 ServerName comm-app.local
 DocumentRoot "D:/xampp/htdocs/CommunicationApp/public"
 SetEnv APPLICATION_ENV "development"
 <Directory D:/xampp/htdocs/CommunicationApp/public>
  DirectoryIndex index.php
 AllowOverride All
 Order allow,deny
 Allow from all
 </Directory>
</VirtualHost>

1 个答案:

答案 0 :(得分:1)

我找到了答案。只需重新安排我的.htaccess文件。

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]
# The following rewrites all other queries to index.php. The 
# condition ensures that if you are using Apache aliases to do
# mass virtual hosting, the base path will be prepended to 
# allow proper resolution of the index.php file; it will work
# in non-aliased environments as well, providing a safe, one-size 
# fits all solution.
#RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
#RewriteRule ^(.*) - [E=BASE:%1]
RewriteRule ^.*$ index.php [NC,L]

重新排列.htaccess文件后重启我的apache.Now工作正常。