URL rewriting - 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: URL rewriting (/showthread.php?tid=20363) |
URL rewriting - El Forum - 07-07-2009 [eluser]Ickes[/eluser] Noob education ongoing.... Trying to learn about URL formation in CI. 1 question I can't seem to answer. For example, Have class Blog with function one_entry(). To access, user goes to this page address -> index.php/blog/one_entry/article-name.html. How would I change that to index.php/blog/<b>one-entry</b>/article-name.html without renaming the function itself? That is, how do I replace _ with -? Is this possible? I have read the User Guide on Routing but don't think that is my answer. I also checked this forum entry but that didn't help either but I may not have grasped all of it. Help for Custom URL. URL rewriting - El Forum - 07-07-2009 [eluser]Chad Fulton[/eluser] I think Routing is your answer. Try this: Code: $route['blog/one-entry/:any'] = 'blog/one_entry/$1'; Why don't you think Routing is your answer? It seems like you want a pretty straightforward mapping from one URI (with one-entry in it) to another (with one_entry in it). |