Casey Flynn Casey Flynn - 2 years ago 218
PHP Question

CodeIgniter routes map all URI segments to one controller/method

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) ---(routed)--->

Anyone know what I'm missing?

Figured it out!
$route['(.*)'] = 'primary/index/$1';
Also I forgot to remove index.php with .htaccess

Answer Source

try this

$route['(.*)'] = "primary/$1";
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download