What could be causing redirect errors? |
Can you identify why the "Piket" page is showing a 404 error even though the required code has been added in the view and controller, and the other pages are redirecting successfully?
if ($userdata['tipe'] == 99) { redirect('admin'); } else if ($userdata['tipe'] == 88) { redirect('guru'); } else if ($userdata['tipe'] == 55) { redirect('piket'); } else if ($userdata['tipe'] == 77) { redirect('sekretaris'); } } **P.S : The "Guru", "Admin", and "Sekretaris" successfully redirected, but when I add "piket" shown the error 404** And here's the code on controller : public function index() { $id = $this->session->userdata('id_user'); $this->load->view('backend/layouts/wrapper', [ 'content' => 'backend/piket/home', 'title' => 'Beranda', 'profile' => $this->user_m->profile($id), 'userdata' => $id ], FALSE); } Can you tell me the error of my code?
You are doing it wrong to redirect to a URI path you have to use
PHP Code: // Go to specific URI path. "admin/home" is the URI path relative to baseURL. in your case PHP Code: if ($userdata['tipe'] == 99) { For a brief instruction, I would suggest you check the official documentation. Redirect
Learning Codeigniter
Based on the code you provided, it seems that the "Piket" page is not being found even though the required code has been added in the view and controller. One possible reason for this error is that the "Piket" page may not exist or may not be located in the correct directory. Another possibility is that there may be a typo in the file name or directory path. Double-check the file name and directory path for the "Piket" page and make sure they are correct.
|
Welcome Guest, Not a member yet? Register Sign In |