Third segment of URI - 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: Third segment of URI (/showthread.php?tid=19829) |
Third segment of URI - El Forum - 06-19-2009 [eluser]juan1904[/eluser] Hi, I'm working on a forum for my webpage which got a pagination function, and it works perfectly fine when I'm browsing the first page of the forum, but when I click my pagination to view the second page I get a "404 Page Not Found"-error. Here's some code from my controller: Code: function index($offset = 0) The URI seem to not like that I give my index-function a parameter. I've got a .htaccess file which removes index.php from my URI. Third segment of URI - El Forum - 06-20-2009 [eluser]juan1904[/eluser] I found my problem now. I need to write the URI like forum/index/(a number). But I don't want to write the second URI index, is there any way to write it like forum/(a number) Third segment of URI - El Forum - 06-20-2009 [eluser]Dam1an[/eluser] URI routing to the rescue Third segment of URI - El Forum - 06-20-2009 [eluser]juan1904[/eluser] I've actually already read that one ;-) But I don't understand how I can get 2 URI-segments when the real URI is 3 segments. Third segment of URI - El Forum - 06-20-2009 [eluser]Dam1an[/eluser] Well, if you want forum/123 to point to forum/index/123, use something like Code: $route['forum/(:num)'] = 'forum/index/$1'; Make sense? Third segment of URI - El Forum - 06-21-2009 [eluser]juan1904[/eluser] Thank you Dam1an! Third segment of URI - El Forum - 06-21-2009 [eluser]Dam1an[/eluser] You're welcome (Damian does it again!) |