CodeIgniter Forums

Full Version: css, js, img in view don't work
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have this structure but can't acces (css, js, img) files
Code:
<?php echo base_url('application/views/admin/css/style.css'); //don't work ?>
<?php echo base_url('application/views/default/css/style.css'); //don't work ?>

application
 - views
  -- template
   --- admin
    ---- css
     ----- style.css
    ---- js
    ---- img
  --- default
   ---- css
    ----- style.css
   ---- js
   ---- img

i have this .htaccess

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

Now i remove htaccess from application but is not a good solution
You need to place your assets folder in the root along with index.php
You need to place your assets folder outside the application folder like:

your project folder
     application
     assets
     etc....


the access the files like:


PHP Code:
<?php echo base_url('asstes/css/style.css'); 


OR


PHP Code:
<?php echo base_url()assets/css/style.css ?>
What your doing is wrong You need to place your assets folder outside the application folder and not inside it should be like:

This below
application
assets
etc....


the access the files Not the way you are doing it now
i know use assets but i need this structure

application
- views
-- template
--- admin
---- css
----- style.css
---- js
---- img
--- default
---- css
----- style.css
---- js
---- img
You can change the view folder in index.php to point to your own view folder.