Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I try to redirect to a specific function in the same controller, but it doesn't redirect and only shows a white page (blank).

Trying to redirect to some specific url, it's still not moving to the url.

signin controller:

public function index() 
    {
    
        $this->generateToken();

        $data = array(
            'title' => 'MASUK',
            'breadcrumb' => 'MASUK',
            'menu' => 'MASUK',
            'login' => 'active',
            'captcha' => $this->refresh_captcha(),
            'msg' => '',
            'infoMSG' => ''
        );
    
        if (isset($this->session->userdata['logged_in']['usr_email']) == "") {

            $this->template->load('template', 'signin', $data);
        } else {
         //var_dump(base_url());  // show the base url 
         //redirect('https://www.facebook.com');  // not direct to specific url too
         redirect('Signin/logout');
        }
        // else {
        // redirect('landing');
        // }
    }


 public function logout()
    {
    print_r("mask");  //not print anything 
            $this->load->library('session');
    
        $this->session->unset_userdata('permission');
        $this->session->unset_userdata('logged_in');
        $this->session->unset_userdata('session');
        $this->session->unset_userdata('userinfo');
        $this->session->unset_userdata('api_loc');
        $this->session->sess_destroy();
    
        redirect('signin');
    }

.htaccess file:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
question from:https://stackoverflow.com/questions/65859055/redirecting-function-not-redirecting

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
802 views
Welcome To Ask or Share your Answers For Others

1 Answer

Try adding a ? at the end of index.php in your last rewrite rule.

RewriteRule ^(.*)$ ./index.php?/$1 [L,QSA]

If that doesn't work, try changing your config.php 'uri_protocol' if it's set to AUTO.

$config['uri_protocol'] = 'REQUEST_URI';

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...