Igniter Code Not Found 404 Error

I have a problem with my site. After upgrading to mySQL 5.6, the host povider recompiled Apache and PHP. apparently they also updated the WHM cPanel.

since at the moment my site may be displayed correctly, but when I try to log in, it cannot find the requested page.

Error message:

The requested URL / main / cek_login was not found on this server. In addition, when trying to use ErrorDocument to process a request, a 404 Not Found error was detected.

error messages from cPanel:

[Mon Dec 22 10:10:58 2014] [error] File does not exist: / home / xxx / public_html / main [Mon Dec 22 10:10:56 2014] [error] File does not exist: / home / xxx / public_html /404.shtml

My analyzes so far:

CI version: 2.2
PHP version: 5.4.3.5 mySQL
version: 5.6.21
cPanel Version 11.46.1 (build 4)

main -> actually a file called main.php
  cek_login - > a function inside main.php that runs a check against an entry in the user table.

folder structure as follows.

/home
   /application
       /controllers
           /main
       /view
          /login_view
   /system
   /assets
   /cgi-bin 

Code as follows

<div class="loginForm">
  <?=($_GET[ 'error'])? "<div class='alert'>$_GET[error]</div>": ""?>
    <form class="form-horizontal" action="<?php echo base_url().'main/cek_login'; ?>" method="POST">

config.php inside the application folder
 $ config ['base_url'] = '';
 $ config ['index_page'] = '';
 $ config ['uri_protocol'] = 'REQUEST_URI'; → tried AUTO before but is useless. Previously was AUTO

.htaccess
RewriteEngine On
RewriteCond% {REQUEST_FILENAME}! -f
RewriteCond% {REQUEST_FILENAME}! -d
RewriteRule ^ (. *) $Index.php/$1 [L]

.htaccess

routes.php
$ route ['default_controller'] = "main";
$ route ['404_override'] = 'not_found';

, .

base_url . .

NEW Code Igniter PHP, . .

, .

,

+4
3

. 1. , main.php main.php Main, CI_Controller,

class Main extends CI_Controller

2., .htaccess . , .

your_site_url/index.php/main/cek_login//make sure cek_login function exists inside the controller

, .htaccess 3. cpanel , .htaccess .
, .htaccess, , . , .htaccess .
, , .

+2

, config.php

$config['base_url']

'routes.php',

$route['main/(:any)'] = 'main/index';

.

// Login check
    $exception_uris = array(
            'main/cek_login',
            'main/cek_logout'
    );
    if (in_array(uri_string(), $exception_uris) == FALSE) {
        if ($this->user_m->loggedin() == FALSE) {
            redirect('main/cek_login');
        }
    }
+1

.

1. info.php 2.

<?php
 phpinfo();

3. http://www.yourdomain.com/info.php

  1. , roon info.php

  2. If this http://www.yourdomain.com/info.php does not work, contact your server support to fix it. Mostly the problem is with the server configuration, not with the Codeigniter files.

+1
source

Source: https://habr.com/ru/post/1568589/


All Articles