CodeIgniter Forums
URI / - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: URI / (/showthread.php?tid=6662)



URI / - El Forum - 03-06-2008

[eluser]MMCCQQ[/eluser]
hi!

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

http://domain.com/username/add_article

main/add_article
Class / Controller

i got this

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

its the best solution??


URI / - El Forum - 03-07-2008

[eluser]xwero[/eluser]
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.


URI / - El Forum - 03-07-2008

[eluser]MMCCQQ[/eluser]
how can i do it?


URI / - El Forum - 03-07-2008

[eluser]xwero[/eluser]
Code:
$route[’(:any)/(:any)’] = ‘main/$2’ ; // http://domain.com/username/add_article
$route[’(:any)’] = “main/index/$1”; // http://domain.com/username