CodeIgniter Forums
How do you do a simple redirect? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How do you do a simple redirect? (/showthread.php?tid=21065)



How do you do a simple redirect? - El Forum - 07-29-2009

[eluser]tomdelonge[/eluser]
I keep trying, but weird things happen.

Once it is supposed to redirect, it takes forever, and then the browser says:

The connection has timed out
The server at localhost.com is taking too long to respond.

But the weird thing is then the url in the address bar is the one I was trying to redirect to...

Is this not how to do it?: (I have the url helper loaded)
Code:
function testing()
    {
        if ( ! $this->session->userdata('logged_in'))
        {
             redirect('/admin/');
        }

    }



How do you do a simple redirect? - El Forum - 07-29-2009

[eluser]Dam1an[/eluser]
What happens if you try just
Code:
redirect('admin');
The slashes shouldn't make a differance but just in case
Also, if you go to that page directly, does it work ok?


How do you do a simple redirect? - El Forum - 07-29-2009

[eluser]tomdelonge[/eluser]
Yeah if I go right to "localhost/admin" everything works fine. I removed the slashes, but to no avail... Is the redirect intended to be used the way I am?


How do you do a simple redirect? - El Forum - 07-29-2009

[eluser]Dam1an[/eluser]
try setting the second parameter to refresh


How do you do a simple redirect? - El Forum - 07-29-2009

[eluser]tomdelonge[/eluser]
It still doesn't work.

Another thing I just noticed is that after it has the correct url in the address bar, if i go and click on the address bar and press enter, it goes through the same charades (taking forever, with a "problem loading page" thing from firefox.


How do you do a simple redirect? - El Forum - 07-29-2009

[eluser]tomdelonge[/eluser]
Another thing I noticed is that if I set redirect with "refresh" or "location", the correct url doesn't end up in the address bar.