【问题标题】:Setting up for Zend Framework htaccess file设置 Zend Framework htaccess 文件
【发布时间】:2013-02-02 00:28:12
【问题描述】:

这是我的项目目录:

/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.

【问题讨论】:

    标签: .htaccess zend-framework


    【解决方案1】:

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

    【讨论】:

    • 如何编辑 DOCUMENT_ROOT?我可以只使用没有虚拟主机的 htaccess 文件吗?
    猜你喜欢
    • 2012-08-26
    • 1970-01-01
    • 2012-08-26
    • 2013-01-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多