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

Today I have come up with another solution, "How to remove controller name from url to make clean in codeigniter".
Oce a time I faced same issue but I fixed it so I thought to share. 
Now lets come to the point:
 In my case url was: http://localhost:8080/index.php/page/sometext Where "Page" is the controller name.
Open routes.php file: application/config/routs.php 
 Write the following 2 line code below in routes.php file 

 $urlParam = $this->uri->segment_array()[1] ;
 $rout[$urlParam] = "page/index" ;

Now check URL;
 Result: http://localhost:8080/index.php/sometext I assure you, it will work. tested 100%.


Don't forget to check following amazing products






No comments

Powered by Blogger.