I have the following url..
http://localhost/ci/site_controller/home
I want to remove site_controller
controller
I just found the solution in this link, it works for me: http://ellislab.com/forums/viewthread/148531/
$route['^(page1|page2|page3|page4)(/:any)?$'] = "YOURCONTROLLERNAME/$0";
Hope it helps you :)
Drop the 'ci'
from your routes. That is your project name and is never required. Routes always start on the controller level:
$route['home'] = "site_controller/home";
Will work. However, more importantly.. are you sure your design is correct? Why not just let home
be a controller? Create a /application/controllers/home.php
and you'll be able to access it's index()
function with http://localhost/ci/home
.
You're complicating things. No need for routes at all.
assuming you currently have your url http://localhost/ci/site_controller/home
you can just write an explicit route like below to your /application/config/routes.php
$route['ci/home'] = 'site_controller/home';
or
$route['ci/home'] = 'ci/site_controller/home';
if your controller is namespaced to /application/controllers/ci/