![]() |
URL Routing Issue - 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 Routing Issue (/showthread.php?tid=11432) |
URL Routing Issue - El Forum - 09-08-2008 [eluser]Unknown[/eluser] I'm pulling my hair out over this one. I've used CI for a couple projects now and I honestly don't understand why this isn't working. My understanding is that routes work top-down, so if the first one matches it stops there. If I have this URL, domain.com/first-person-inside-the-smart-car/1738722217 it always goes to the first route defined below. I can't get it to go to the second route. Has anyone bumped into this issue before? It's driving me crazy and I can't figure out why it doesn't work like I've always known it to. Code: $route[':any/:any/(:num)'] = 'video/setPlaylist/$1'; URL Routing Issue - El Forum - 09-09-2008 [eluser]swanky[/eluser] Switch them around. Numbers are anything. Code: $route[':any/(:num)'] = 'video/setPlaylist/null/$1'; URL Routing Issue - El Forum - 09-09-2008 [eluser]Unknown[/eluser] [quote author="swanky" date="1220991046"]Switch them around. Numbers are anything. [/quote] When I switch them around, a url like domain.com/playlist-name/video-1/12345678 gets routed to this one: Code: $route[':any/(:num)'] = 'video/setPlaylist/null/$1'; which makes absolutely no sense to me. The second portion of the URL isn't even a number, but the number on the end (in this example 12345678) is getting passed into the controller. URL Routing Issue - El Forum - 09-11-2008 [eluser]swanky[/eluser] It's the number in video-1 (i.e. 1) that's causing your problems. I'd use a regex instead if your second segment will be a alpha numeric. |