CodeIgniter Forums
Problem with redirect - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Problem with redirect (/thread-9842.html)



Problem with redirect - El Forum - 07-10-2008

[eluser]nuts[/eluser]
Hello,

I have made a global view in which I have inserted some located views (as user login block ...) all the links in the user block are working but I have a problem when I call my logout function with :
Code:
<?=anchor('users/logout','logout');?>

In fact, my function logout must redirect on the last url that the user was seeing (thanks to a flashdata session) but the redirection isn't as she must be.

My flashdata session is constructed like that
Code:
$last_url = $this->uri->segment(1).'/'.$this->uri->segment(2).'/'.$this->uri->segment(3);
$this->session->set_flashdata('last_url',$last_url);

My redirection is :
Code:
redirect($this->session->flashdata('last_url'));

But, instead of redirecting to site_url($this->session->flashdata('last_url')) it redirect to base_url().site_url($this->session->flashdata('last_url'))
(So I obtain an invalid URL like 'http://mywebsite.com/codeIgniter/index.php/http://mywebsite.com/codeIgniter/index.php/blog/' :\)
I already had this problem, but I've found another solution, but here, I can't make otherwise :-S

Do someone have any idea ?

Thanks!

Ps: sorry if I've made mistakes with my english, I hope I still readable.

EDIT : Hum, sorry for the post, I've found my problem, the new version of my file hasn't been put on my host (don't know why ...) really sorry :red: