Reputation: 12836
I have been working on codeigniter for past 1 year, but never found this problem, probally because i have been always working with functions with parameters
let me show u the issue
say i have a function like this in my front
class user extends CI_Controller{
public function __construct() {
parent::__construct();
@session_start();
$this->load->library('encrypt');
}
/*------------for registration-------------*/
function register()
{
}
now it will be called like this
http://example.com/user/register
i am passing no arguments in the register function
now if i write like this in the address bar
http://example.com/user/register/abc/abd
then also the register function will be called showing no error
as i am passing two parameters for the register function, and on register function i am not catching them..
i want in such case the 404 error
should be shown,, how can i do this...
Upvotes: 0
Views: 131
Reputation: 43298
You can use the URI class to check if the third URI segment contains anything and if it does you can use show_404()
:
if($this->uri->segment(3) !== FALSE)
{
show_404();
}
Upvotes: 1