CodeIgniter Forums
File not found - Printable Version

+- CodeIgniter Forums (
+-- Forum: CodeIgniter 4 (
+--- Forum: CodeIgniter 4 Support (
+--- Thread: File not found (/showthread.php?tid=76623)

File not found - the_steff - 06-03-2020

Hi !

My application is working fine with wamp + virtual host
Moving the app online is causing some routing problems.

I've succeed to have a home page working fine but each link gives a simple "File not found." without any styling or precision concerning the file not found.

I've applied indications of this tuto in order to 'clean' my urls :

I've also realized that added routes are case-sensitive in Routes.php
PHP Code:
$routes->add('/''pages::view');   // gives a styled 404 error page 
PHP Code:
$routes->add('/''Pages::view');    // working fine
$routes->add('(:any)/''Pages::view/$1');     // just display "file not found" 

Hope somebody can help me !

RE: File not found - the_steff - 06-03-2020


Actually, adding "index.php" to urls make the app running fin.

Why these lines in my .htaccess didn't do the job ? (this is the .htaccess initially stored in the public dir that I copied to my root dir)

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

RE: File not found - the_steff - 06-03-2020

I've noticed something really strange.

Here is a part of my header.php code :

<link rel="icon" href="<?php echo base_url();?>images/favicon-GRO.ico" />
<link rel="stylesheet" href="<?php echo base_url();?>css/style.css" />

And when I display the html source code from firefox I get

<link rel="icon" href="<my_base_url as declared in app.php>/images/favicon-GRO.ico" 
<link rel="stylesheet" href="<my_base_url as declared in app.php>/public/css/style.css" />

Why did I get "public" for my css and not my image ???

RE: File not found - InsiteFX - 06-04-2020

Try this.

PHP Code:
// change this
$routes->add('(:any)/''Pages::view/$1');     // just display "file not found" 

// to this
$routes->add('/(:any)''Pages::view/$1');     // just display "file not found" 

// you can change this
<link rel="icon" href="<?php echo base_url();?>images/favicon-GRO.ico" />

// to this
<link rel="icon" href="<?php echo base_url('images/favicon-GRO.ico');?>" /> 

RE: File not found - the_steff - 06-04-2020

Thanks !

I suppose I found my "real" problem. I'm hosted with a mutu solution where the public directory is named "www". Moving my public content into this "www" directory and then others dir of CI4 to the root "/" seems to solve all these problems.

Thanks !