Welcome Guest, Not a member yet? Register   Sign In
404 pages with latest CI version
#1

(This post was last modified: 01-06-2020, 03:19 PM by byteme.)

Hello,

Yesterday i've added the 3.1 version to the root path of the website from someone I help. The old version  2.0.2 was broken after the webhost upgraded to php7.0 (no way to switch to old version, unlike my webhost, so no quick fix). I've moved the old directories (appliction/system/etc and used the new ones. I compared the old config settings to make sure it's correct. But I get 404 pages from CI itself. I have no clue what I have to change to make it work.

I have an index.html with the complete naviagation structure/links as it should be working temporarily.

When i want to open www.website.com/index.php it gives 404 error
When i want to open www.website.com/index.php/welcome/ (as default) it gives 404 error
When i want to open www.website.com/CATEGORY/product-title (the way the links used to work) it gives 404 error

I don't think the .htacces is faulty, but here is it anyway:

Code:
#AddHandler x-httpd-php53 .php

<IfModule mod_rewrite.c>

    # Make sure directory listing is disabled
    Options +FollowSymLinks -Indexes
    RewriteEngine on

    # NOTICE: If you get a 404 play with combinations of the following commented out lines
    #AllowOverride All
    #RewriteBase /wherever/pyro/is

    # Restrict your site to only one domain
    #RewriteCond %{HTTP_HOST} !^example\.com$
    #RewriteRule ^(.*)$ http://example.com/$1 [L]

    # Keep people out of codeigniter directory and Git/Mercurial data
    RedirectMatch 403 ^/(system\/pyrocms\/cache|system\/codeigniter|\.git|\.hg).*$

    # Send request via index.php (again, not if its a real file or folder)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    <IfModule mod_php5.c>
        RewriteRule ^(.*)$ index.php/$1 [L]
    </IfModule>

    <IfModule !mod_php5.c>
        RewriteRule ^(.*)$ index.php?/$1 [L]
    </IfModule>

</IfModule>

When i view the error_log of the host I dont find error (makes sence, as the 404 is from CI itself).

Some other config settings:

Code:
$config['index_page'] = '';
$config['base_url'] = '';
$config['uri_protocol']    = 'REQUEST_URI';
$config['language']    = 'dutch';
$config['subclass_prefix'] = 'MY_';
$config['encryption_key'] = 'VALUEXX';

$route['default_controller'] = 'products';

$route['404'] = 'page';

$route['admin/help/([a-zA-Z_-]+)']        = 'admin/help/$1';
$route['admin/([a-zA-Z_-]+)/(:any)']    = '$1/admin/$2';
$route['admin/(login|logout)']            = 'admin/$1';
$route['admin/([a-zA-Z_-]+)']            = '$1/admin/index';
I changed the indexpage to index.php, did'nt make difference. The default_controller value is copied from the old website. As I read the manual, there should be a file products, but it doesn't exist anywhere, so I guess it's never used? Rest is also copied.

So basically the two questions are: how do i solve the 404 errors? And how can i make the links work correctly?

From the top navigation the old website linked to: www.website.com/page/title
from the sidebar the old website categorized the products in blocks and linked every product to: www.website.com/category/product

Thanks in advance!

EDIT:

I disabled the show_404 function here:

Code:
        // Did we reset the $e404 flag? If so, set the rsegments, starting from index 1
        if ( ! $e404)
        {
            $class = $error_class;
            $method = $error_method;

            $URI->rsegments = array(
                1 => $class,
                2 => $method
            );
        }
        else
        {
            //show_404($RTR->directory.$class.'/'.$method);
        }

Which gives the output in browser:

Code:
An uncaught Exception was encountered

Type: Error

Message: Class '' not found

Filename: /home/xxxxx/domains/website.nl/public_html/system/core/CodeIgniter.php

Line Number: 518

Backtrace:

File: /home/xxxx/domains/website.nl/public_html/index.php
Line: 317
Function: require_once

Is it because i Disabled the 404 function, or is this the error which wasn't shown because of the show_404?

Addition:

It seems i still had to copy some files and had to fill the base_url, it was pointing to an IP address, not the correct URL. After some database errors (config was empty) i'm again stuck at new errors:

Code:
A PHP Error was encountered

Severity: Notice

Message: Only variables should be passed by reference

Filename: MX/Loader.php

Line Number: 141

Backtrace:

File: /home/xxx/domains/website.nl/public_html/application/third_party/MX/Loader.php
Line: 141
Function: _error_handler

File: /home/xxxx/domains/website.nl/public_html/application/third_party/MX/Loader.php
Line: 176
Function: library

File: /home/xxxx/domains/website.nl/public_html/application/third_party/MX/Loader.php
Line: 139
Function: libraries

File: /home/xxx/domains/website.nl/public_html/application/controllers/Categories_demo.php
Line: 22
Function: __construct

File: /home/xxxx/domains/website.nl/public_html/index.php
Line: 318
Function: require_once

This one might not be a big deal for now, but the next one is:

Code:
An uncaught Exception was encountered

Type: Error

Message: Call to undefined method MY_Loader::_ci_load_class()

Filename: /home/xxx/domains/website.nl/public_html/application/third_party/MX/Loader.php

Line Number: 158

Backtrace:

File: /home/xxx/domains/website.nl/public_html/application/third_party/MX/Loader.php
Line: 176
Function: library

File: /home/xxx/domains/website.nl/public_html/application/third_party/MX/Loader.php
Line: 139
Function: libraries

File: /home/xxx/domains/website.nl/public_html/application/controllers/Categories_demo.php
Line: 22
Function: __construct

File: /home/xxx/domains/website.nl/public_html/index.php
Line: 318
Function: require_once

When i Google this particular problem, it seems people solved it by going from from ci_load_library to ci_load_class...
Reply
#2

Sorry for my nagging, but i'm still lost why it isn't working:

Code:
    $e404 = FALSE;
    $class = ucfirst($RTR->class);
    $method = $RTR->method;

    if (empty($class) OR ! file_exists(APPPATH.'controllers/'.$RTR->directory.$class.'.php'))
    {
        $e404 = TRUE;
    }

I did find out the $class at this point is empty, so it always falls in the $e404=TRUE. How/where can I find out what the cause is?
Reply
#3

(This post was last modified: 01-08-2020, 01:33 PM by jreklund.)

"So basically the two questions are: how do i solve the 404 errors? And how can i make the links work correctly?"
application/controller/Products.php dosen't exist.

The problem are in your third_party folder.
Filename: /home/xxx/domains/website.nl/public_html/application/third_party/MX/Loader.php
Line Number: 158
and
Line Number: 141

Can you show what it are trying to do? Never heard of that function before.
Reply
#4

(01-08-2020, 01:30 PM)jreklund Wrote: "So basically the two questions are: how do i solve the 404 errors? And how can i make the links work correctly?"
application/controller/Products.php dosen't exist.

The problem are in your third_party folder.
Filename: /home/xxx/domains/website.nl/public_html/application/third_party/MX/Loader.php
Line Number: 158
and
Line Number: 141

Can you show what it are trying to do? Never heard of that function before.
As I checked what the configs/routes do, I found this line in the old setup:

$route['default_controller'] = 'producten';

And then there should be the file 'producten.php' under controllers, but I can't find it anywhere, not in new and old version of the website. The previous developer added this. So my confusion is getting bigger: how can the old website work w/h this file and now it can't?

When I change it to:

$route['default_controller'] = 'welcome';

Then it still is giving the 404 (empty $class issue as stated in my previous reply)
Reply




Theme © iAndrew 2016 - Forum software by © MyBB