Is URI segment 2 reserved? |
[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
[eluser]xwero[/eluser]
The second segment is the method of the class. Routing solves this Code: $route['mail/(.+)'] = 'mail/index/$1';
[eluser]kwhitaker[/eluser]
Thanks, that did the trick. Would you mind dissecting the code a bit so I know what exactly is going on?
[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 . |
Welcome Guest, Not a member yet? Register Sign In |