Always show 404 with incorrect parameters? - 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: Always show 404 with incorrect parameters? (/showthread.php?tid=53623) |
Always show 404 with incorrect parameters? - El Forum - 07-31-2012 [eluser]Unknown[/eluser] *** Edit: I already asked this last year. Figures. I can't see how to delete this. *** If someone enters an incorrect controller name, my site properly shows my custom 404 page. However, only one of my controller's methods accepts a parameter. I would expect CodeIgniter to also generate a 404 if an unsupported number of parameters are passed to a method. For example, if the function is defined as: Code: public function something() … then it seems any number of parameters can be passed via URL, even if it's not supported by the function. If I try: Code: http://site.com/controller/something/1/2/3/4/5/5 … it does not generate an error, the function is still called and the page loads. I don't want my visitors to think that's valid. If I try: Code: public do something(void) … then I just get a white page no matter how many parameters are passed. Like I said before, this particular controller has many functions, and only one that accepts a single optional parameter. Is there a way (via routs or something) to automatically handle validation of parameters? Thanks. |