![]() |
CodeIgniter has a robust routing module as part of its MVC architecture. A trap for the inexperienced arises when the default controller works (e.g. site.com) but anything else such as mysite.com/dashboard goes to a server based 404, not the CodeIgniter one.
Solution: in your config.php file ensure this line is present
and place the following code in an .htacess file
Options +FollowSymLinks
# Set the default file for indexes
DirectoryIndex index.php
<IfModule mod_rewrite.c>
# activate URL rewriting
RewriteEngine on
# do not rewrite links to the documentation, assets and public files
RewriteCond $1 !^(images|assets|uploads|captcha)
# do not rewrite for php files in the document root, robots.txt or the maintenance page
RewriteCond $1 !^([^\..]+\.php|robots\.txt|maintenance\.html)
# rewrite everything else
RewriteRule ^(.*)$ index.php/$1 [L]
<I/IfModule>
<IIfModule !mod_rewrite.c>
# If we don’t have mod_rewrite installed, all 404′s can be sent to index.php, and everything works as normal.
ErrorDocument 404 index.php
<I/IfModule>




| Based on a theme by Ori Pearl