CodeIgniter Forums
Removing Controller Name - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: Removing Controller Name (/thread-18998.html)



Removing Controller Name - El Forum - 05-24-2009

[eluser]pengenbelajarCI[/eluser]
I've watching screencast, and i very curious of how to removing controller from url.

I've tried this on rout

Code:
$route['default_controller'] = "main";
$route['scaffolding_trigger'] = "";

$routearr = array ('main','company','users');
foreach ($routearr as $v ) {
    $route[$v] = $v;    
    $route[$v.'/(.*)'] = $v."/$1";    
}
$route['/(.*)'] = "main/index/$1";

But it doesnt work, because i always get 404 error


Removing Controller Name - El Forum - 05-25-2009

[eluser]Jondolar[/eluser]
Did you create a .htaccess file and add the following:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

Check out:
http://ellislab.com/codeigniter/user-guide/general/urls.html