URI Routing
This file lets you remap URI requests to a specified controller function
In general, there is a "one-to" relationship between the URL string and the Controller class/method it corresponds to. The segments in the URL typically follow the following pattern:
Example.com/class/method/id/
However, in some instances, you may want to remap this relationship to invoke a different class/method instead of a URL corresponding to the class/method
Please see the User Guide for complete information:
Https://codeigniter.com/user_guide/general/routing.html
Reserved routes
There are three reserved routes:
$route [' default_controller '] = ' welcome ';
If the URI does not contain any data (such as Access www.codeigniter.com), this route determines which controller class should be loaded.
$route [' 404_override '] = ' errors/page_missing ';
If the parameters provided in the URL do not match any legitimate route, this route tells the router which controller/method to use
$route [' translate_uri_dashes '] = FALSE;
Specifically, this is not a route, but it allows you to automatically route controllers and method names that contain dashes "-", '-' not a valid class or method name character, so it needs to be translated
When you set this option to true, it will displace all the dashes in the controller segment and method segment, such as Access My-controller/index will be converted to My_controller/index by the router.
If the URI contains News/create, the Create method of the news controller is called
$route [' news/create '] = ' news/create ';
If the first paragraph of the URI is news and the second paragraph is any character, then the view method of the news controller is called, and any character of the second paragraph is passed as an argument to it
$route [' news/(: any) '] = ' news/view/$1 ';
$route [' news '] = ' news ';
If you access www.codeigniter/index.php/a, you will access the view method of the pages controller and pass in parameter a
$route [' (: Any) '] = ' pages/view/$1 ';
When accessing www.codeigniter.com, the view method of the pages controller is accessed
$route [' default_controller '] = ' pages/view ';
application/config/routes.php