CodeIgniter is based on a URL concept. That means that the controller, as the central control unit between the view and the model, is accessed by entering a URL into the search bar of the web browser. Developers create so-called controller classes. These are PHP files that contain various functions used to load libraries, plugins, or helpers, connect to databases, integrate a data model, or search for a specific view.
The application flow of CodeIgniter is based on the following URL structure:
example.com/class/function/parameter
The domain (example.com) is followed by a controller class, that should be addressed, as well as a particular controller function. The end forms the optional parameters. These are used to deliver the controller IDs or variables.
In theory, a CodeIgniter URL could look like this:
example.com/news/article/511
Such a URL addresses the controller news on the domain example.com and prompts the function article to be executed (for example, loading a view of the same name for presentation of the article). Which contents of the data model should be retrieved from the database and which are passed to the controller via the URL are optional parameters – in this example an article with the ID 511.
In the output configuration, CodeIgniter quotes index.php in every application URL:
example.com/index.php/news/article/511
This PHP file contains information about where to find the core files of the framework. It also helps you find integrated libraries, plugins, or helpers as well as in which index the application files are contained. The index.php is used to initialize all base resources.
If CodeIgniter runs on the Apache HTTP server then the index.php and mod_rewrite can be removed from the application URL to make a “clean” web address available for the end users and search machine crawlers. Developers insert the following code block into the .htaccess file of the web server: