Home > Net >  CI page not found
CI page not found

Time:06-21

page error

My htaccess

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

My Controller

<?php
defined('BASEPATH') or exit('No direct script access allowed');

class Auth extends CI_Controller
{
public function __construct()
{
    parent::__construct();
    $this->load->library('form_validation');
}

public function index()
{
    $this->form_validation->set_rules('username', 'Email', 'required|trim');
    $this->form_validation->set_rules('password', 'Email', 'required|trim');
    if ($this->form_validation->run() == FALSE) {
        # code...
        $data['title'] = 'Login';
        $this->load->view('templates/auth_header', $data);
        $this->load->view('auth/login');
        $this->load->view('templates/auth_footer');
    } else {
        $this->_login();
    }
}

anyone know my problem? I think my syntax is correct but the page is still not found. anyone help me, I'm still a beginner in the field of programmers

CodePudding user response:

    **First, you check, that the post data is checked if the condition or else condition inside echo and exit the post data.**
    
    public function index()
    {
        $this->form_validation->set_rules('username', 'Email', 'required|trim');
        $this->form_validation->set_rules('password', 'Email', 'required|trim');
        if ($this->form_validation->run() == FALSE) {
      echo " If stmt ";
 exit();
            # code...
            $data['title'] = 'Login';
           
        } else {
      echo " else stmt";
     exit();
            $this->_login();
        }
    }

CodePudding user response:

Please add this htaccess file in application folder.It may helps

<IfModule authz_core_module>
    Require all denied
</IfModule>
<IfModule !authz_core_module>
    Deny from all
</IfModule>

Your htaccess file is in outside the application folder.This was also needed.

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
  • Related