Setting up for Zend Framework htaccess file

2019-09-11 08:25发布

问题:

That is my project dir:

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

That is my code in /myproject/index.php

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

Code in .htaccess file:

#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

Problem is that I can't load css,img or js files from css,img,js directories.

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

回答1:

This is not a htaccess problem. Your DOCUMENT_ROOT should point at your public folder, but it looks like it's currently pointing at your myproject folder (this is a big security hole). You'll probably find that /myproject/css/style.css will work fine. You should update your virtual host settings to fix this.