需要有关htaccess,zend framework 2项目的帮助

时间:2015-03-14 06:02:32

标签: apache .htaccess zend-framework2

我的设置

虚拟主机http://loc1.localhost/

虚拟主机配置

<VirtualHost *:80>
   ServerName loc1.localhost
   DocumentRoot E:\xampp\htdocs\loc1\public

   <Directory E:\xampp\htdocs\loc1\public>
       AllowOverride All
       Require all granted
   </Directory>
</VirtualHost>

我的htaccess

RewriteEngine on

RewriteCond %{HTTP_HOST} ^(www.)?loc1.localhost$
RewriteCond %{REQUEST_URI} !^/loc1/public/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /loc1/public/$1

RewriteCond %{HTTP_HOST} ^(www.)?loc1.localhost$
RewriteRule ^(/)?$ /loc1/public/index.php [L]

我能够将我的网站视为loc1.localhost

问题是我无法在loc1 / library

下引用我的css文件

我相信我的htaccess有问题

任何人都可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

考虑到您的文档根目录为E:\xampp\htdocs\loc1\public,您的索引文件,.htaccess文件和资源(CSS和图像等)应位于此处。

所以:

loc1\public\
loc1\public\.htaccess
loc1\public\index.php
loc1\public\library\main.css

您无法从文档根目录下方(即您的public目录)加载任何文件。