localhost上的CodeIgniter:重定向太多

时间:2016-12-12 12:31:59

标签: php codeigniter redirect

出于测试目的,我将所有代码和数据库记录从我们的实时服务器复制到本地服务器。

我编辑了以下文件:

/application/config/config.php(我也编辑过DB记录)

//$config['base_url']   = 'https://www.OurWebsite.eu/';
$config['base_url'] = 'http://localhost/test/';

的index.php

//define('ENVIRONMENT', 'production');
define('ENVIRONMENT', 'development');

/application/config/database.php

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'test_localhost';
$db['default']['password'] = '**************';

但是当我打开网页浏览器时,我必须遵循以下错误:

Firefox:The page is not well redirected

Chrome:ERR_TOO_MANY_REDIRECTS

我已经尝试在 /application/config/config.php

中更改此内容
$config['uri_protocol'] = 'AUTO';

所有其他值,但没有一个值。

我还尝试删除 .htaccess 但没有成功。

的.htaccess

<IfModule mod_rewrite.c>
    RewriteEngine on

    RewriteBase /

    RewriteCond $1 !^(themes)

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteCond $1 !^(index\.php|assets|static|img|css|js|map|favicon\.ico)
    RewriteRule ^(.*)$ ./index.php?/$1 [L,QSA]
    RewriteRule ^sitemap\.xml$ ./index.php?/$1 [L,QSA]
    RewriteRule ^robots\.txt$ ./index.php?/$1 [L,QSA]

</IfModule>

<IfModule mod_deflate.c>
    <filesMatch "\.(js|css|png)$">
        SetOutputFilter DEFLATE
    </filesMatch>
</IfModule>

AddOutputFilterByType DEFLATE text/ico text/html text/plain text/xml text/css application/javascript application/x-javascript application/x-httpd-php application/rss+xml application/atom_xml text/javascript

实时服务器运行时没有错误,代码完全相同。 我真的不知道怎么办...... 我以前从未使用过CodeIgniter,我可能需要启用特定的PHP扩展吗?

3 个答案:

答案 0 :(得分:1)

如果你在构造函数中使用重定向而不是删除它我有同样的问题,但最后得出的结论是我在构造函数中使用了重定向来进行登录会话

答案 1 :(得分:0)

当我检查项目会话数组变量时,我遇到了相同的问题,该变量用于检查有效用户该变量在此会话数组中不存在,这就是它导致问题的原因(太多重定向)。检查它是您的会话数组或其他变量。 也许对您有帮助。

答案 2 :(得分:0)

最后我必须在.htacces中写上这个

$config['base_url'] = 'http://www.my-site.local/'; //Don't forget the final '/'

/application/config/config.php

http://www.my-site.local

在数据库中:/(无尾随log.debug({title:'webRep',details:webrep});

相关问题