CodeIgniter Forums
File not found - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- 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 :
https://www.tutsmake.com/codeigniter-4-remove-public-and-index-php-from-url/

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 !
Thanks!


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

Okay...

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)

Code:
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 :


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


Code:
<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 !