CodeIgniter Route Configuration
Route configuration generally used for remapping URL string. Typically there is a one-to-one relationship between an URL string and its corresponding controller class/method. The segments in a URI ...
Key Architecture Takeaways
- ›Point 1: Full-stack architecture blueprint: CodeIgniter Route Configuration.
- ›Point 2: Covers MVC separation of concerns, routing pipelines, and database abstraction.
- ›Point 3: Modern ecosystems: Laravel 11/PHP 8.3, React 19, and Node.js LTS runtimes.
Modern Framework Landscape (2026)
Web engineering patterns have evolved: Laravel now utilizes PHP 8.2+ typed properties, Vite asset bundling, and strict Eloquent typing, while Node.js LTS supports native fetch and ESM modules out of the box.
Route configuration generally used for remapping URL string. Typically there is a one-to-one relationship between an URL string and its corresponding controller class/method. The segments in a URI normally follow this pattern:
example.com/class/function/id/In some instances, however, you may want to remap this relationship so that a different class/method can be called instead of the one corresponding to the URL.
For example, you have a class for displaying users profile having the class name "user" and function "base_info()" with user id as following:
example.com/user/base_infoNow you want to remap the URL like this:
example.com/profile/idSetting your own route configuration rules using following steps:
- *Go to your application directory then open routes.php file under config directory( application /config / routes.php ).
- At end of file find $route array
- Specify your own routeing criteria ($route['profile/:num']='user/base_info'*;)**
<blockquote>
Note : Routes can either be specified using wildcards or Regular Expressions.
</blockquote>
Wildcards
A typical wildcard route might look something like this:
$route['profile/:num']='user/base_info';
In a route, the array key contains the URI to be matched, while the array value contains the destination it should be re-routed to. In the above example, if the literal word "profile" is found in the first segment of the URL, and a number is found in the second segment, the "user" class and the "base_info" method are instead used.
You can match literal values or you can use two wildcard types these are:
- (:num) will match a segment containing only numbers. - (:any) will match a segment containing any character (except for '/', which is the segment delimiter).
There are three reserved routes:
1) $route['default_controller'] = 'welcome';
This route indicates which controller class should be loaded if the URI contains no data. In the above example, the "welcome" class would be loaded.
2) $route['404_override'] = 'errors/page_missing';
This route will tell the Router which controller/method to use if those provided in the URL cannot be matched to a valid route.
3)$route['translate_uri_dashes'] = FALSE;
This is not exactly a route but allows you to automatically route controller and method names that contain dashes. '-' isn't a valid class or method name character, so it requires translation. When you set this option to TRUE, it will replace ALL dashes in the controller and method URI segments.
[<
