301 erero on apache [英] 301 erorr on apache

查看:150
本文介绍了301 erero on apache的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好.
我有一个基于MVC的用PHP编写的项目.
问题是我在apache上收到301错误,但在Windows服务器上却没有.
我使用在线工具将web.config转换为htaccess文件.
现在问题的详细信息:
网址类似于:www.abc.com?cid=0,其中cid是资源管理器树结构的根的id.现在,每次调用此url时,此cid都应更改为返回该节点的子代.
控制器结构中以及循环发生位置的代码:

Hello .
I have a project written in PHP based on MVC.
The problem is I get a 301 error on apache but not on windows servers.
I converted web.config to htaccess file using an online tool.
now the details of the problem :
the url is like : www.abc.com?cid=0 in which cid is id of a root of a explorer tree structure. now each time this url is called this cid should change to return the childs of that node.
The code in the constructure of the controller and where the loop happens :

function __construct() {

    parent::__construct ();
    Auth::handleLogin ();

    if (! (isset ( $_GET ['cid'] ) && strlen ( $_GET ['cid'] ) > 0)) {
        header ( 'location: ' . URL . "newscategories?cid=0" );
    }
 
}



控制器中处理请求的实际方法:



The actual method in controller to handle request :

function index() {
        if (Auth::handleLogin () && Auth::HasPermission ( PER_MNG_NEWS_GROUP )) {
            // -------------
            $cid = 0;
            if (isset ( $_GET ['cid'] ) && strlen ( $_GET ['cid'] ) > 0) {
                $cid = $_GET ['cid'];
            }
            $this->view->editid = '';
            if (isset ( $_GET ['e'] )) {
                $this->view->editid = $_GET ['e'];
            }
            // ---------------
            $tknid = self::get_token_id ();
            $tknvl = self::get_token ();
            $_SESSION ['TOKENEXPIRETIME'] = time () + TokenDeadLine;

            $this->view->cat_list = $this->model->getcats ( $cid );
            $this->view->cat_path = $this->model->getcatpath ( $cid );

            if (sizeof ( $this->view->cat_path ) == 0)
                header ( 'location: ' . URL . "newscategories?cid=0" );
            $this->view->cid = $cid;
            $this->view->tokenid = $tknid;
            $this->view->tokenvalue = $tknvl;
            $this->view->render ( 'news/categories' );
        }




我应该提到这在IIS上可以正常使用,并且htaccess的内容是:




I should mention this works fine on IIS and the content of htaccess is :

#SECURITY

<IfModule mod_rewrite.c>
RewriteEngine On

#REWRITE RULES
#RULE IMPORTED RULE 1
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php?url=$1 [L]
</IfModule>



如果有人可以帮助我,将不胜感激.



would be very grateful if someone could hep me please.

推荐答案

_GET ['
_GET ['cid'] ) && strlen (


_GET [' cid'])> 0 )){ 标头(' 位置:'.URL." newscategories?cid = 0"); } }
_GET ['cid'] ) > 0)) { header ( 'location: ' . URL . "newscategories?cid=0" ); } }



控制器中处理请求的实际方法:



The actual method in controller to handle request :

function index() {
        if (Auth::handleLogin () && Auth::HasPermission ( PER_MNG_NEWS_GROUP )) {
            // -------------
            


cid = 0 ; 如果(isset(
cid = 0; if (isset (


这篇关于301 erero on apache的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆