【发布时间】:2015-05-29 16:57:45
【问题描述】:
我有这个基本控制器:
class TCMS_Controller extends CI_Controller{
public function __construct(){
parent::__construct();
if( ! $this->session->userdata('logged_in')){
redirect('admin/authenticate/login');
}
//Loop to get all settings in the "globals" table
foreach($this->Settings_model->get_global_settings() as $result){
$this->global_data[$result->key] = $result->value;
}
}
}
所以我有这个基本的重定向:
redirect('admin/authenticate/login'); 如果用户未登录。
我还有这个设置可以从网址中删除index.php:
.htaccess:
Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond ${REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
以及下一个配置设置:
$config['base_url'] = 'http://something.herokuapp.com/';
$config['index_page'] = '';
当我尝试访问具有下一个地址的管理部分时:
http://something.herokuapp.com/admin/controller/method
如果我没有登录,我应该被重定向到login 页面:
http://something.herokuapp.com/admin/authenticate/login
但是我得到了一个重定向循环
ERR_TOO_MANY_REDIRECTS
我该如何解决?
页面: http://tcms.herokuapp.com/
管理部分:http://tcms.herokuapp.com/admin/authenticate/login http://tcms.herokuapp.com/admin/dashobard
【问题讨论】:
-
请检查您的浏览器控制台以查看页面实际尝试重定向到的内容。
-
你能显示你的刷新网址链接吗?
-
添加了网站链接
标签: php .htaccess codeigniter redirect codeigniter-routing