I have a really weird problem. I have been using CI for more than 2 years and it's the first time I found this kind of problem. I found that the redirect function is not working properly. I already load the url helper in autoload.php.
$autoload['helper'] = array('url','html','form','file');
What I want to do is to redirect the users to a controller if they call admin controller.
class Admin extends CI_Controller {
function index(){
redirect('secure');
}
}
But what happen is the page redirected to the base_url. I've tried adding the second parameter of redirect with refresh or location but the result is just the same. It also happens to all redirect function in other controller. Can anyone tell me what the cause of this problem to happen?
EDIT: For additional information that might be helpful for finding the problem, here I put the code of the routes.php.
$route['default_controller'] = "frontpage";
$route['404_override'] = 'errors/page_missing';
$route['admin'] = 'secure';
I just figured out that the problem is caused by a function in my helper. By coincident, I use site_url() function in the helper, which is already used by the CI. I replace that function with another name and now the redirection is working perfectly. I don't know how it can affects the redirect function, though. Thanks for anybody tried to help me.