here, home.php is one controller file and i want to redirect into another controller file login.php but this code is not working. if you have any idea then plz help me...


<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Home extends CI_Controller{
    function __construct(){

    public function index(){

        echo 'Congratulations, you are logged in.';

        echo "<br /><a href=''.base_url().'home/do_logout'>Logout</a>";

    private function check_isvalidated(){
        if(! $this->session->userdata('validated')){

    public function do_logout(){

Recommended Answers

All 2 Replies


is the URL helper automatically loaded? By enabling the log in CI you should be able to get more information about the error, just check into application/logs/. Try also to prefix the redirect link with a slash, for example:


Before redirecting, try $this->load->helper('url');. Also, try to do a redirect like so redirect('login','refresh');

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.