Welcome Guest, Not a member yet? Register   Sign In
File not found
#1

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-r...-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!
Reply
#2

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]
Reply
#3

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 ???
Reply
#4

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');?>" /> 
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#5

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




Theme © iAndrew 2016 - Forum software by © MyBB