Codeigniter - 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: Codeigniter - redirect (/showthread.php?tid=49711) |
Codeigniter - redirect - El Forum - 02-29-2012 [eluser]Unknown[/eluser] hi there, i face a problem when using redirect function. What i want to do redirect if user successfully login. if (!$userID) { $this->session->set_flashdata('login_error', TRUE); } else { $this->session->set_userdata(array( 'logged_in' => TRUE, 'userID' => $userID, 'username' => $username)); redirect("welcome_page"); } however,the new link is like that <a href="http://www.ressim.net/i/5512048_painterror-png.html"><img src="http://img1.ressim.net/out.php/i5512048_painterror-png" alt="Ucretsiz Resim yukle ve Paylas" border="0" /></a> Codeigniter - redirect - El Forum - 02-29-2012 [eluser]Refringe[/eluser] What is the URL supposed to be? Are you loading the URL helper before you use the redirect function? Code: $this->load->helper('url'); Codeigniter - redirect - El Forum - 02-29-2012 [eluser]Unknown[/eluser] yes i load it in constructor for example i write redirect("base_url()") it makes http://localhost:81/pasaj/giris/main_page/localhost/pasaj/localhost/pasaj what i want to do is making it localhost/pasaj/localhost/pasaj why i dont know but i appends to former url. Codeigniter - redirect - El Forum - 02-29-2012 [eluser]CroNiX[/eluser] because you are only supposed to put the segments in redirect() (see the docs), you are putting base_url() so it's the whole url getting appended to the current url. Try: redirect('pasaj'); Codeigniter - redirect - El Forum - 02-29-2012 [eluser]Matalina[/eluser] @CroNiX The docs say: Quote:If you specify the full site URL that link will be build, I'm just clarifying that if you supply a whole url it won't redirect to the url supplied? Not on topic but if I read it right your statement is not correct based on the above quote. The language is off so it might be incorrect in my thinking... @Mert Your orignal posts has "welcome_page" I'm assuming that's a controller? If not you must put the controller before the method name. redirects direct to a url not a view (that was one of my initial issues with CI.) |