CodeIgniter Forums
Remove Controller - Printable Version

+- CodeIgniter Forums (
+-- Forum: Using CodeIgniter (
+--- Forum: Choosing CodeIgniter (
+--- Thread: Remove Controller (/thread-1320.html)

Remove Controller - kavy - 02-27-2015

I have to remove controller name from the URL in CodeIgniter for my website but my others controller is not working .
its showing this message " The page you requested was not found ".

I used following code for remove my website controller name from routers.php:

$default_controller = "webportal";
$route['default_controller'] = $default_controller;
$controller_exceptions = array('admin','email');

$route['default_controller'] = $default_controller;
$route["^((?!\b".implode('\b|\b', $controller_exceptions)."\b).*)$"] = $default_controller.'/$1';
$route['404_override'] = '';

RE: Remove Controller - ngangchill - 02-28-2015

read this

hope it will solve ur problem...

RE: Remove Controller - janesmith - 03-03-2015

You can set your a route for each url:
In your config/routes.php file, just set each page like this:

$route['ci/home'] = "ci/site_controller/home";

RE: Remove Controller - John_Betong - 03-20-2015

Multiple routes can be set as follows:

('overloaded', 'hs-pix', 'Health-and-Safety-Pictures', 'health-and-safety-pictures',
'health-and-safety', 'safety-at-work', 'safety_at_work',
foreach($xs as $x):
$route[$x] = "c_pix/safety";