![]() |
Is URI segment 2 reserved? - 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: Is URI segment 2 reserved? (/showthread.php?tid=9644) |
Is URI segment 2 reserved? - El Forum - 07-02-2008 [eluser]kwhitaker[/eluser] Hello all. I'm writing a CI application that sends emails, so I have a controller called email, funny enough. Now this controller requires a parameter before it will generate a page, otherwise it kicks the user back to the index page. My problem is that if I go to this url: www.example.com/index.php/mail/parameter I get a 404. Is segment 2 reserved? If so, how would you recommend that I get around this particular issue? Code pasted here: Code: <?php Is URI segment 2 reserved? - El Forum - 07-02-2008 [eluser]xwero[/eluser] The second segment is the method of the class. Routing solves this Code: $route['mail/(.+)'] = 'mail/index/$1'; Is URI segment 2 reserved? - El Forum - 07-02-2008 [eluser]kwhitaker[/eluser] Thanks, that did the trick. Would you mind dissecting the code a bit so I know what exactly is going on? Is URI segment 2 reserved? - El Forum - 07-02-2008 [eluser]Pascal Kriete[/eluser] Normally CodeIgniter urls are www.example.com/controller/function/parameter1/param2/etc .. Routes are nothing more than regular expressions. ".+" means one or more character, and the parentheses 'capture' that. So, the regular expression xwero is using says www.example.com/mail/anything should point to mail/index/anything . |