gutaker
gutaker

Reputation: 181

codeigniter route does not route as expected

in php word "list" is reserved so i had to use "listby" and create route. According to CI User Guide I have created a route as follows:

$route['list'] = "listby";

It's routing perfectly the index function with url like "http://myserver.com/list" but does not route other functions i.e.. "http://myserver.com/list/uuid".

Here's contorller code:

class Listby extends CI_Controller
{

    public function index()
    {
        echo "index";
    }

    public function userid()
    {
        echo "userid";
    }

    public function uuid()
    {
        echo "uuid";
    }
}

Side note: with url like "http://myserver.com/listby/uuid" works fine.

Any clues where is the problem?

Upvotes: 1

Views: 289

Answers (1)

raidenace
raidenace

Reputation: 12826

try:

$route['list/(:any)'] = "listby/$1";

Upvotes: 1

Related Questions