I have the following class in my controller (codeigniter)
class Books extends CI_Controller {
function index($id = NULL){
//model
//view
}
}
I have this link in my view file
<a href="<? echo base_url();">/books/index/<? echo $id ;?> > Book1</a>
when I click on the above link the URL in the address bar looks like >
http://localhost/my_web/books/index/1
But I am trying to make the URL look like-
http://localhost/my_web/books/1
So, after studying this tutorial, in my application/config/routes.php I used the following code.
$route['books/:num'] = "books/index";
And then I changed my link to following code, but when I click on it, the page says 404 Page not found
<a href="<? echo base_url();">/books/<? echo $id ;?> > Book1</a>
Could you please tell how to achieve this?
Thanks in Advance :)