CodeIgniter Forums
Unable to load the requested file - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Unable to load the requested file (/showthread.php?tid=77471)



Unable to load the requested file - vishwajithkeshan2 - 09-05-2020

I tried to create a login system using ion_auth library
 This is my welcome controller:
PHP Code:
<?php
defined
('BASEPATH') OR exit('No direct script access allowed');

class 
Welcome extends CI_Controller {

public function 
__construct(){
    
parent
::__construct();
$this->load->library('ion_auth');
  if (!$this->ion_auth->logged_in())
    {
    redirect('auth/login''refresh');
     
    
}
    
}

    public function 
index()
    {
    
$this->load->view('welcome_message');


    }

 When I Run this shows an error

An Error Was Encountered

Unable to load the requested file: auth/login.php

How can I fix this?


RE: Unable to load the requested file - Omar Crespo - 09-05-2020

Just use header instead of redirect, like this:

header('Location:' . site_url('auth/login'));
exit();

I'm just asuming that auth is a controller, and login it's method.

Hope it helps.