Remove controller name from the URL in CodeIgniter

Example URL:

here “controller” is your controller name

“function” is controller function

“parameter” is parameter of pages function.

Now if we remove controller name from url,it should work ,

Open application/config/routes.php file ,and modify the entire code like this

$default_controller = "controller"; // default controller name
$route['default_controller'] = $default_controller;

// here i removed controller name from url
$controller_exceptions = array(“function”); // here function is controller function you can mention as many as controller function that we can exclude controller name from the url

foreach($controller_exceptions as $v) {
$route[$v] = “$default_controller/”.$v;
$route[$v.”/(.*)”] = “$default_controller/”.$v.’/$1′;
now run your project url like :

2 thoughts on “Remove controller name from the URL in CodeIgniter”

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>