Reputation: 3267
This is my code in routes.php
$route['default_controller'] = "admin";
$route['(:any)'] = $route['default_controller']."/index/";
This is my url:
http://myserver.net/visio/jklmn
But i cant to get the value in index()
in admin
controller.
I want to get the value jklmn
in admin
controller.If there is any mistake in my routing code.
This is my index() code;
function index($key = ""){
if(isset($key)){
$newkey = $key;
$data['key'] = $key;
$this->load->view('index',$data);
}else{
redirect('admin/index_login');
}
}
When i taking above link in browser i get the error message below:
Not Found
The requested URL /visio/jklmn was not found on this server.
Upvotes: 0
Views: 117
Reputation: 2130
Use this routing rule:
$route['(:any)/(:any)'] = $route['default_controller']."/index/$2";
which will match a URL with 2 segments (each containing any character) and pass the second match as $2
.
You can also pass the first match, just use $1
.
Upvotes: 1