![]() |
Best way to remove "content" from my url - 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: Best way to remove "content" from my url (/showthread.php?tid=37449) |
Best way to remove "content" from my url - El Forum - 01-10-2011 [eluser]tommo.wilson[/eluser] Hi there, I have a CMS which I have built and currently the url's for a page look like this... http://www.example.com/content/example-page http://www.example.com/content/test-page What I would like is to have the pages look like this instead... http://www.example.com/example-page http://www.example.com/test-page How would I go about doing that? Cheers Tom Best way to remove "content" from my url - El Forum - 01-10-2011 [eluser]DBPolito[/eluser] I don't know if it is the best way, but some time i used this in config/routes.php: $route['^((?!controller_names|controller_names)\S*)'] = "controller/function/$1"; Replace controller_names by your controllers that you don't want redirect. Someone have another way? Regards Best way to remove "content" from my url - El Forum - 01-10-2011 [eluser]portgaz[/eluser] Hi I think you can use this one: Code: $route['content/(.*)'] = '$1'; Best way to remove "content" from my url - El Forum - 01-10-2011 [eluser]tommo.wilson[/eluser] Hi DBPolito That works perfectly...not sure why because I'm not that hot at regular expressions. But thanks all the same. Tom |