如何通过将id从页面链接传递给控制器​​来获取当前页面的内容

I am working in Codeigniter.

Here is my code which I have written so far to achieve what I am thinking.

View:

<li><a href=" echo $menu->url.'/'.$menu->id " >Gallery</a></li>

Controller:

function view($id){

$content['content'] = $this->MyModel->getContent($id);
$data['header'] = $this->load->view('header', '', true);
$data['content'] = $this->load->view('content', $content, true);
$this->load->view('main_view', $data);

}

Model

 function getContent($id){

$this->db->select('page_title, content');
$this->db->from('admin_pages');
$this->db->where('id', $id);
............
return $query;
}

Route

$route['view/(:any)'] = 'mycontroller/view/$1'; 

What I want to achieve here is, when I click the link in the "View" then it should show me another page with the content of that specific link fetched from the "admin_pages" table based on the parameter "$id" passed to it from the url.

However when I click the link it gives me page not found error.

Any kind of help will be much appreciated.

After trial and error, I found a workaround which I want to share for future references if made.

I changed the link as:
View

<li><a href=" echo base_url().'page/'. $menu->id; " >Gallery</a></li>

Then in the route I changed:
Route

$route['page/(:any)'] = 'mycontroller/view/$1'; 

What this means is, whenever there in the URL is base_url/page followed by an "id" then it will be remapped or taken to the "view" method in the controller "mycontroller" and the id will be passed as a parameter to the method, which the method will recieve as $id in its definition.