How to remove controller name from url making it clean in codeigniter How to remove controller name from url making it clean in codeigniter codeigniter codeigniter

How to remove controller name from url making it clean in codeigniter


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";


This might help you to define a Default Controller for your CodeIgniter project.

https://codeigniter.com/user_guide/general/controllers.html#defining-a-default-controller

For instance, in your case, open your application/config/routes.php file and set this variable:

$route['default_controller'] = 'site_controller';


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/