CodeIgniter Forums
Route URL Question - 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: Route URL Question (/thread-9593.html)



Route URL Question - El Forum - 07-01-2008

[eluser]Unknown[/eluser]
Hello All

How to implement shortcut url in codeigniter?

Example:
http://myspace.com/rnrm it is routed to the rnrm home profile.
http://myspace.com/signin it is routed to the signin controller
http://myspace.com/invalid it is an 404 error because invalid is not a valid profile or it is not a valid controller

I have modify route configuration like this:

Code:
$route['(.*)']='url/profile/$1';

And this is sample controller to determine if the url is valid or not:
Code:
class Url extends controller {
    function profile($url)
        if (isValidProfile($url)){
            $this->load->view('theprofile');
        }else{
            if(isValidController($url){

                // confusing here
                // how to route/forward to the corresponding controller

            }else{
                show_404();
            }
        }
    }
}
Thx in advance...