I have a Controller named Categories and one function in it called index with 1 parameter $cat_id
so it looks like this:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class categories extends CI_Controller {
function __construct(){
parent::__construct();
}
public function index($cat_id = null){
}
}
the problem comes when i call it from the browser… i use this:
http://www.mysite.dev/categories/12311323
but returns 404 error page
instead if i use
http://www.mysite.dev/categories/index/12313131
will work fine…
how can i make sure it wont need index in the URL for the index function?
The default CodeIgniter routing is /controller/function/argument. In order to specify an argument, you need to first specify the function. If you want to specify an argument without the function, you need to define a custom route. Adding this line to your route configuration file should do what you want.