CI4 in a shared host subfolder |
Sorry, I suppose it's a very repeated question, but I'm locked with that problem :-(
I updated my CI4 application to my hosting at http://dimas.cat - Uploaded code to public_html/esventplanr - Changed $baseUrl in App.php to http://dimas.cat/eventplanr/ - Copied index.php and .htaccess from public_html/esventplanr/public to public_html/esventplanr - In index.php, I updated $pathsConfig to FCPATH . 'app/Config/Paths.php'; As you can see, http://dimas.cat/eventplanr/ it's accessible, but all the assets aren't loaded. CI4 tries to find it at http://dimas.cat/eventplanr/ but they are at http://dimas.cat/eventplanr/public . If I change the $baseUrl to the public folder, the assets work ok, but not CI4 routing. In the code I use <?=base_url('bootstrap/css/bootstrap.min.css')?> or <?=base_url().'bootstrap/css/bootstrap.min.css'?> How can I solve it? Thx!! (06-13-2023, 06:13 PM)dimas Wrote: In the code I use <?=base_url('bootstrap/css/bootstrap.min.css')?> or <?=base_url().'bootstrap/css/bootstrap.min.css'?> Use <?=base_url('bootstrap/css/bootstrap.min.css')?>. See https://codeigniter4.github.io/CodeIgnit...l#base_url (06-13-2023, 07:09 PM)kenjis Wrote: Do you want to setup the site http://dimas.cat/eventplanr/ ? http://dimas.cat/eventplanr/ (06-13-2023, 07:12 PM)kenjis Wrote:(06-13-2023, 06:13 PM)dimas Wrote: In the code I use <?=base_url('bootstrap/css/bootstrap.min.css')?> or <?=base_url().'bootstrap/css/bootstrap.min.css'?> The result is exactly the same. The URL generated is http://dimas.cat/eventplanr/bootstrap/cs...ap.min.css and the file is in http://dimas.cat/eventplanr/public/boots...ap.min.css If I change the baseUrl from 'http://dimas.cat/eventplanr/' to 'http://dimas.cat/eventplanr/public' the assets are loaded ok, but the CI routing not. And I don't want to see public/ in the url.
This is the case for http://dimas.cat/
https://forum.codeigniter.com/showthread.php?tid=76779 You want http://dimas.cat/eventplanr/, so make the eventplanr folder in public_html, and put all the following files into it. Code: dimas.cat.eventplanr/ (create a folder with any name you like) And fix the path in index.php: PHP Code: // Load our paths config file
Navigate to http://dimas.cat/eventplanr/img/logo-192x192.png , you see "Can't find a route for 'get: /img/logo-192x192.png'. "
So your .htaccess config is something wrong. All requests are routed to CI4 and the web server cannot serve images files. (06-14-2023, 01:34 AM)kenjis Wrote: Navigate to http://dimas.cat/eventplanr/img/logo-192x192.png , you see "Can't find a route for 'get: /img/logo-192x192.png'. "Exact, but if you go to http://dimas.cat/eventplanr/public/img/logo-192x192.png it works. How can I redirect it? (06-14-2023, 01:34 AM)kenjis Wrote: So your .htaccess config is something wrong.This is my http://dimas.cat/eventplanr/.htaccess , is it wrong? Code: # Disable directory browsing
Oh, your img folder locates in wrong place.
It should be: Code: dimas.cat.eventplanr/ (create a folder with any name you like) |
Welcome Guest, Not a member yet? Register Sign In |