2013-02-01 61 views
0

这是我的项目目录:为Zend框架htaccess文件设置

/webroot 
/myproject 
    index.php 
    /application 
    /config 
    /library 
    /public 
     /css 
     /img 
     /js 
     index.php 
     .htaccess 

这是我在/myproject/index.php代码

<?php include 'public/index.php'; 

代码在.htaccess文件:

#SetEnv APPLICATION_ENV development 

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} -s [OR] 
RewriteCond %{REQUEST_FILENAME} -l [OR] 
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule ^.*$ - [NC,L] 
RewriteRule ^.*$ index.php [NC,L] 
RewriteRule !\.(js|ico|gif|jpg|png|css|swf|html|pps)$ index.php [NC,L] 

order allow,deny 
allow from all 

问题是我无法从css,img,js目录加载css,img或js文件。

The requested URL /css/style.css was not found on this server. 

回答

0

这不是一个htaccess的问题。你的DOCUMENT_ROOT应该指向你的公共文件夹,但它看起来像是当前指向你的myproject文件夹(这是一个很大的安全漏洞)。你可能会发现/myproject/css/style.css会正常工作。你应该更新你的虚拟主机设置来解决这个问题。

+0

如何编辑DOCUMENT_ROOT?我可以只使用没有虚拟主机的htaccess文件吗? –