how codignitetr recognzes controllername,methodname,id from url like:
The most used method for this is CI_URI->segments();
Read more here: https://www.codeigniter.com/userguide3/libraries/uri.html#CI_URI::segment
So, each / after your host be different segment.
For example:
//http://stackoverflow.com/controllername/methodname/id
echo $this->uri->segment(1); // controllername
echo $this->uri->segment(2); // methodname
echo $this->uri->segment(3); // id