Where do I put image files, css, js, etc. in Codeigniter?

前端 未结 14 1240
挽巷
挽巷 2020-11-30 16:57

Where is it acceptable to put css folders and image file folders? I was thinking inside the view folder? However the controller always reroutes the path to the base url so I

14条回答
  •  感情败类
    2020-11-30 17:16

    (I am new to Codeigniter, so I don't know if this is the best advice)

    I keep publicly available files in my public folder. It is logical for them to be there, and I don't want to use Codeigniter for something I don't need to use it for.

    The directory tree looks likes this:

    • /application/
    • /public/
    • /public/css/
    • /public/img/
    • /public/js/
    • /system/

    The only files I keep in /public/ are Codeigniter's index.php, and my .htaccess file:

    RewriteEngine On
    RewriteBase /
    
    RewriteRule ^css/ - [L]
    RewriteRule ^img/ - [L]
    RewriteRule ^js/ - [L]
    
    RewriteRule ^index.php(.*)$ - [L]
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    

提交回复
热议问题