DijkeMark
DijkeMark

Reputation: 1306

URL routing in codeigniter is not working

I need to send a var (an int with value 3) to an index function in a controller.
No problems with that, except the url looks like this:

tasks/index/3

I want the url to be like this:

tasks/

I tried this in the routes.php, but then it gives an error saying the page can't be found.

$route['tasks/index/(:num)'] = 'tasks';

Upvotes: 1

Views: 128

Answers (1)

Bogdan Rybak
Bogdan Rybak

Reputation: 2117

It's the other way around.

Try doing:

$route['tasks/(:num)'] = 'tasks/index/$1';

CI Routing docs

Upvotes: 2

Related Questions