CodeIgniter Forums
URl - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forum-6.html)
+--- Forum: Issues (https://forum.codeigniter.com/forum-19.html)
+--- Thread: URl (/thread-1590.html)



URl - amit363 - 03-23-2015

same page is opening if i add the unwanted text after Slash for example
In this Page www.example/kb/article/mac-data/
or in this Page www.example/kb/article/mac-data/72riwgffffg


RE: URl - ciadmin - 03-23-2015

Sounds like a routing problem. Are you using any custom routes?


RE: URl - Avenirer - 03-24-2015

And this is not normal?

You can put something like

PHP Code:
public function article ($param_one$param_two NULL)
{
 
 if(!is_null($param_two))
 
 {
 
   //do whatever redirect you want
 
 }
 
 // else do what you need to do


Or you can simply find out if the number of parameters are bigger than what you need with func_num_args().


RE: URl - CroNiX - 03-24-2015

CI doesn't know how many segments a controller is SUPPOSED to respond to. It's looking for the controller/method and passing anything extra to the method (depending on how you set your method up). As suggested, if you don't want it to respond if it has like 3 segments, you need to check for that and issue an error or show_404()