![]() |
route all URL to only one controller! - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: route all URL to only one controller! (/showthread.php?tid=6176) |
route all URL to only one controller! - El Forum - 02-17-2008 [eluser]Unknown[/eluser] I want to use smarty as template, and I want to use URL like www.myserver.com/index.php/templategroup/templatename/parm1/parm2/.... templategroup and templatename will be fetched from database. for that need to have only controller to do this. I don't know how to do this. route all URL to only one controller! - El Forum - 02-17-2008 [eluser]wiredesignz[/eluser] Read the user guide: http://ellislab.com/codeigniter/user-guide/general/routing.html http://ellislab.com/codeigniter/user-guide/general/controllers.html#remapping route all URL to only one controller! - El Forum - 02-17-2008 [eluser]Unknown[/eluser] I got it using regExp routing: $route['(.*)'] = "site/$1"; @wiredesignz thanks for the hints route all URL to only one controller! - El Forum - 02-17-2008 [eluser]systemsos[/eluser] [quote author="amirbukhari" date="1203271667"]I got it using regExp routing: $route['(.*)'] = "site/$1"; @wiredesignz thanks for the hints[/quote] I used the $route[':any'] = 'my_default_controller' Then worked out it killed everything else unless I added it manually below it; $route['blog/:any'] = 'my_blog_controller' $route['blog'] = 'my_blog_controller' So I figured it was probably best to only forward the bits I wanted, rather than everything and then minus out the parts I wanted to keep going to their own controller. route all URL to only one controller! - El Forum - 02-17-2008 [eluser]zauber[/eluser] I needed to do something similar, and ended up extending the Router class (it's a real small and simple extension). I wanted any requests like: http://mysite.com/some_page_name to be equivalent to: http://mysite.com/page/read/some_pag_name. ... and I wanted to set it up in routes with "$route['default_query'] = 'page/read';" Perhaps not exactly what you need, but it might give you some ideas for what is possible. Here's my original post that has the extension I made (didn't get any responses yet): http://ellislab.com/forums/viewthread/71877/ |