CodeIgniter Forums
Codeigniter - redirect - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: Codeigniter - redirect (/thread-49711.html)

Codeigniter - redirect - El Forum - 02-29-2012

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 {

'logged_in' => TRUE,
'userID' => $userID,
'username' => $username));


however,the new link is like that
<a href=""><img src="" alt="Ucretsiz Resim yukle ve Paylas" border="0" /></a>

Codeigniter - redirect - El Forum - 02-29-2012

What is the URL supposed to be?

Are you loading the URL helper before you use the redirect function?


Codeigniter - redirect - El Forum - 02-29-2012

yes i load it in constructor

for example
i write redirect("base_url()")
it makes

what i want to do is making it

why i dont know but i appends to former url.

Codeigniter - redirect - El Forum - 02-29-2012

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.


Codeigniter - redirect - El Forum - 02-29-2012

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...

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.)