CodeIgniter Forums
uri routing / default controller question - 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 routing / default controller question (/showthread.php?tid=14345)



uri routing / default controller question - El Forum - 12-30-2008

[eluser]Unknown[/eluser]
hi,

i'm trying to setup my urls to look like the following

mysite.com/index.php/foo/news/id
mysite.com/index.php/foo/portfolio
mysite.com/index.php/bar/news/id
mysite.com/index.php/bar/portfolio

where foo and bar are dynamic (they would be checked with a category name in a database). News/Portfolio would be the controller i want to call, and foo/bar would be the 'category' for each controller

i'm assuming i'd have to use the uri routing for this, but i'm pretty stumped at the moment as to how to set it up for this task Sad


uri routing / default controller question - El Forum - 12-30-2008

[eluser]Phil Sturgeon[/eluser]
Something along the lines of:

Code:
$route[':any/portfolio'] = 'portfolio/category/$1';
$route[':any/news/:num'] = 'news/article/$2/$1';
$route[':any/news'] = 'news/category/$1';