CodeIgniter routes map all URI segments to one controller/method

codeigniter, php, url-routing

Solution

try this

$route['(.*)'] = "primary/$1";

Problem

I have CI app with one controller, 'primary.' I want to map all requests to the method primary->index() and pass the segments as arguments to the index method. I've tried setting up a route in config/routes.php: $route['(:any)'] = "primary/index/$1"; but for some reason this is not working Ex: (I want) www.example.com/test/delta ---(routed)---> www.example.com/primary/index/test/deta Anyone know what I'm missing? Figured it out! $route['(.*)'] = 'primary/index/$1'; Also I forgot to remove index.php with .htaccess

Original source