设置为Zend框架htaccess文件

设置为Zend框架htaccess文件

本文介绍了设置为Zend框架htaccess文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的项目目录:

  /根目录
/我的项目
    的index.php
    /应用
    /配置
    /图书馆
    /上市
        / CSS
        / IMG
        / JS
        的index.php
        的.htaccess
 

这是我的code在/myproject/index.php

 < PHP的包括公共/ index.php文件;
 

code。在.htaccess文件:

  #SetEnv APPLICATION_ENV发展

RewriteEngine叙述上
的RewriteCond%{} REQUEST_FILENAME -s [OR]
的RewriteCond%{} REQUEST_FILENAME -l [OR]
的RewriteCond%{} REQUEST_FILENAME -d
。重写规则^ * $  -  [NC,L]
重写规则^ * $的index.php [NC,L]
重写规则\!(JS | ICO | GIF | JPG | PNG | CSS |瑞士法郎|全文| PPS)$的index.php [NC,L]

为了允许,拒绝
允许所有
 

问题是,我不能从CSS中,IMG,JS目录加载CSS,IMG或JS文件。

 请求的URL /css/style.css在此服务器上找到。
 

解决方案

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

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.
解决方案

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.

这篇关于设置为Zend框架htaccess文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 02:35