Via the CodeIgniter User Guide here: http://codeigniter.com/user_guide/general/routing.html
You can remap anything (:any
) to your artist
controller. From there, you can remap contact
, request
, etc. to their respective controllers/functions or you can use your Constructor to check for those and call the correct function. Examples:
Using URI Routing:
$route['contact'] = "contact";
$route['request'] = "request";
... // etc...
$route['(:any)'] = "artist/lookup/$1"; // MUST be last, or contact and request will be routed as artists.
Using your Constructor:
public function __construct($uri) {
if ($uri == "contact") {
redirect('contact');
} elseif ($uri == "request") {
redirect('request');
}
}
This method, however, could result in an infinite loop. I would not suggest it, unless your contact
and request
functions were in the same controller. Then you could just call them with $this->contact()
or $this->request()
instead of the redirect.