I'm trying to create a bug tracking software with multiple projects support.
To achieve that I'd like to use a URL like this:
http://example.com/project/default_project/tickets/view/123
project
is the Project-Controller
default_project
is in this case the project identifier.
tickets
is the controller
view
is the method in the tickets-controller
123
is the ID of the ticket passed to view
How do I create such a routing?
My controller would look like this:
class Tickets extends CI_Controller {
public function index() {
// load all tickets WHERE project_identifier = $this->uri->segment(1)
}
public function view($id) {
// load ticket WHERE project_identifier = $this->uri->segment(n)
// AND ticket_id = $id
}
}
I fixed my problem by adding this line to routes.php in the config folder: