CodeIgniter Forums
why i can't redirect to my controller ? - 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: why i can't redirect to my controller ? (/showthread.php?tid=54656)



why i can't redirect to my controller ? - El Forum - 09-19-2012

[eluser]Mario "St.Peter" Valentino[/eluser]
Hello guy i have a controller in this path
Code:
controllers
   - admin
        - shopping
            -category.php

why i can't redirect to this controller.

i wrote code like this

Code:
<?php
class Login extends CI_Controllers
{
    public function login_check($user,$password)
    {
         //code goes here .....
         //...........

         //then redirect to category controller
         redirect('admin/shopping/category');
    }
}
?>


Code above make me get an error message : The page you requested was not found.

can anyone help me why this happen ?




Thanks



Mario


why i can't redirect to my controller ? - El Forum - 09-19-2012

[eluser]jotorres1[/eluser]
Try using your base_url(), assuming you have it set, and you have loaded URL helper.

Code:
<?php

     $redirect = base_url().'admin/shopping/category';
     redirect($redirect);
?>