![]() |
Help with url routing - 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: Help with url routing (/showthread.php?tid=34190) |
Help with url routing - El Forum - 09-22-2010 [eluser]iambaz[/eluser] Hi, How do I change the routes.php so that url's do not call the method of a controller from it's second segment? For example, I want the user to type a url like the following: www.site.com/content/the-page-title This would invoke the content controller and try to load 'the-page-title' as the method. I don't want the method to load though, I just want to run the content constructor and then use the second segment to identify the page in my database and load the content accordingly. Many Thanks Help with url routing - El Forum - 09-22-2010 [eluser]Jônatan fróes[/eluser] Code: $route['content/(:any)'] = 'content/index/$1'; "content" Controller Code: ... Help with url routing - El Forum - 09-22-2010 [eluser]iambaz[/eluser] Perfect - I had been writing it as: Code: $route['content/(:any)'] = 'content/$1'; Many thanks |