How can I redirect to the success page when the user submit the registration form, the problem is when I submit the form it will redirect to the success view but the page says 404 not found. Is there something wrong in my code?
public function registration() {
$this->load->library('form_validation');
$this->form_validation->set_rules('fname','First Name','required');
$this->form_validation->set_rules('lname','Last Name','required');
$this->form_validation->set_rules('username','username','required');
$this->form_validation->set_rules('password','Password','required');
$this->form_validation->set_rules('cpassword','Confim Password','required|matches[password]');
if ($this->form_validation->run() ) {
$this->load->model('Registration');
$this->Registration->create(
['fname' => ucfirst($_POST['fname']),
'lname' => ucfirst($_POST['lname']),
'username' => ucfirst($_POST['username']),
'password' => md5($_POST['password'])]);
redirect('templates/rsuccess');
} else {
$view_data['page_title'] = 'Register first';
$view_data['errors'] = $this->form_validation->error_array();
$this->load->view('templates/header', $view_data);
$this->load->view('auth/registration');
$this->load->view('templates/footer');
}
}