如何重定向取决于引用控制器? 在codeigniter 3

hi I want to redirect from a controller function to another depending upon the referrer controller and if possible function . is their a way to do it ???

i mean is their a way to know the controller and or function name of referrer url

i tried

   `$rurl= explode(' ', remove_extra_spacess( str_replace(array('http',':',"/"),' ', $this->agent->referrer())));`

remove_extra_spacess removes contiguous spaces but that is not perfect as index.php may be hidden or may not be and sum other variations .

thanks Abdulla for your cooperation but it was my communication issue i will improve it definitely any how have resolve the issue by using an simple trick

 $rurl= explode('/',  str_replace(base_url(),'', $this->agent->referrer()));

and get the referrer url's controller and function in array

hope it will not give an exception so if anyone have any better/ shorter /quicker method to achieve this please share