CodeIgniter Forums
how to redirect back url - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Choosing CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=8)
+--- Thread: how to redirect back url (/showthread.php?tid=66397)



how to redirect back url - demonicinn - 10-19-2016

I using user agent to redirect back url but it workes in single CI, but I'm using multiple site 

if currently i'm using test.domain.com and my session is login and i'm directly used in the url login page like accounts.domain.com then how to redirect back subdomain or back page


RE: how to redirect back url - InsiteFX - 10-19-2016

You can try this:

PHP Code:
/**
 * Method to redirect to the previous page
 *
 * Add to one of your helpers
 *
 * USEAGE: redirectPreviousPage();
 */
if ( ! function_exists('redirectPreviousPage'))
{
 
   function redirectPreviousPage()
 
   {
 
       if (isset($_SERVER['HTTP_REFERER']))
 
       {
 
           header('Location: '.$_SERVER['HTTP_REFERER']);
 
       }
 
       else
        
{
 
           header('Location: http://'.$_SERVER['SERVER_NAME']);
 
       }
 
       
        exit
;
 
   }
}

redirectPreviousPage(); 



RE: how to redirect back url - demonicinn - 10-19-2016

if not working altimes else working


RE: how to redirect back url - demonicinn - 10-19-2016

if not working all times else working

yes its working I'm using browser events to redirect back page.

from 1 subdomain to another subdomain


RE: how to redirect back url - d4jk4 - 10-21-2016

You can add back url to memcache/redis or session