CodeIgniter Forums
[SOLVED] route only one controller - 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: [SOLVED] route only one controller (/showthread.php?tid=42776)



[SOLVED] route only one controller - El Forum - 06-19-2011

[eluser]predat0r[/eluser]
Hi there,

i want to route dynamically only one controller, not all, so:

/post -> /site/post

of course i can use $route['(.*)'] = 'site/$1';

but i dont want to route my admin, auth, .. controller methods

Is it possible to do this in route.php or i have to hardcode all my 'site' methods?

Or htaccess solution?

thanky


[SOLVED] route only one controller - El Forum - 06-20-2011

[eluser]bubbafoley[/eluser]
Code:
$route['posts'] = "site/posts";

of if you want to route more than one

Code:
$route['(foo|bar|baz)'] = "site/$1";



[SOLVED] route only one controller - El Forum - 06-20-2011

[eluser]predat0r[/eluser]
[quote author="bubbafoley" date="1308608801"]
Code:
$route['posts'] = "site/posts";

of if you want to route more than one

Code:
$route['(foo|bar|baz)'] = "site/$1";
[/quote]

Ok, so i take all my methods and write into one line separated with a | sign. Great, thanks