CodeIgniter Forums

Full Version: URI /
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum


how can i do this?
URL http:/
/main/ index/ username
Class Controller URI Segment

Class / Controller

i got this

$route['(:any)'] = "main/index/$1";
$route['(:any)/(:any)'] = 'main/$2' ;

its the best solution??

El Forum

You going to have to switch the routes because in your example you are never going to reach the second route. The rule for adding routes is first comes first served.

El Forum

how can i do it?

El Forum

$route[’(:any)/(:any)’] = ‘main/$2’ ; //
$route[’(:any)’] = “main/index/$1”; //