CodeIgniter Forums

Full Version: Remove Controller
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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'] = '';
read this http://www.web-and-development.com/codei...imize-url/



hope it will solve ur problem...
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";
Done.
Multiple routes can be set as follows:

$xs=array
('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";
endforeach;