CodeIgniter Forums

Full Version: URl
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
Sounds like a routing problem. Are you using any custom routes?
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().
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()