Welcome Guest, Not a member yet? Register   Sign In
/public/assets not access after implementing .htaccess to supress index.php
#1

Downloaded the fresh new Code Igniter 4 and successfully configured to make controller/function URI work properly. However, Even though the App portion of the website is working as desired any public assets placed in the /public/assets folder is no accessible. I get a 404. I have tried a few solutions i found on the internet but none seems help.
Reply
#2

That's how I do it works every time.
PHP Code:
<!-- Core theme CSS (includes Bootstrap)-->
 <
link href="<?= base_url('assets/bootstrap/css/bootstrap.css'); ?>" rel="stylesheet">
 <
script src="<?= base_url('assets/fontawesome/js/all.js'); ?>"></script
What did you Try? What did you Get? What did you Expect?

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

(03-19-2024, 12:13 AM)InsiteFX Wrote: That's how I do it works every time.
PHP Code:
<!-- Core theme CSS (includes Bootstrap)-->
 <
link href="<?= base_url('assets/bootstrap/css/bootstrap.css'); ?>" rel="stylesheet">
 <
script src="<?= base_url('assets/fontawesome/js/all.js'); ?>"></script

I have tried base_url('assets/css/my.css') and 
<head>
<base href="<?= base_url();?>">
<link href="assets/css/my.css" rel="stylesheet">l
</head>

nothing is working. Have also tried the default .htaccess that came bundled with CI4 and this 

.htaccess
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

So far none seems to work.
Reply
#4

See https://codeigniter4.github.io/CodeIgnit...ith-apache
Reply




Theme © iAndrew 2016 - Forum software by © MyBB