In this tutorial, We will learn how to redirect the previous page url in Codeigniter PHP. we may sometimes require to redirect the previous page after login.
Example 1:
<?php
$this->load->library('user_agent');
if ($this->agent->is_referral()){
print_r($this->agent->referrer());
}
Example 2:
<?php
print_r($_SERVER['HTTP_REFERER']);
It will return the previous page url.
Thanks, I hope it will work for you .......