What are CodeIgniter URLs?

| | 1 min read

CodeIgniter URL's are search engine friendly and user friendly. CodeIgniter using segment based approach rather than query string. But it supports query strings, you can optionally enable it.

URI segments:

CodeIgniter follows the Model- view-Controller approach, so the segments of the URI also follows the same. For example -mywebsite.com/article/health/8. The first segment is the controller class. The second one is the method in that controller. The third one is the Id, the parameter which required for that function.

By default, the index.php also part of the URL, but we can remove that by using .htaccess file. Before that, you should enable mode_rewrite in your Apache server. Then add the following rules in the .htaccess file.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

To know more about CodeIgniter URL's, contact us. For further help, check this out.