I have a setup like so
http://localhost/
http://localhost/ci_tada/
http://localhost/ci_tada/application
http://localhost/ci_tada/application/views
http://localhost/ci_tada/application/views/css
http://localhost/ci_tada/application/views/css/master.css
I dont want to have to write
every time i wish to access a css file (the same will apply for images ect)
I want to be able to just use http://localhost/ci_tada/css/master.css
and have it load the correct file.
The .htaccess file is located in the ci_tada folder.
Accepted Answer
Looks like you're using some sort of routes within a framework. You should check, because some frameworks give you the option to do it in the app configuration.
<IfModule mod_rewrite.c>
RewriteEngine On
# directory base, untogle if you want to
# rewrite only starting from /<directory/path>
# RewriteBase /
RewriteRule ^/css/(.*)$ index.php/ci_tada/application/views/css/$1 [PT,L]
#or RewriteRule ^/(.*)/css(.*)$ index.php/$0/views/css$1 [PT,L]
#or RewriteRule ^/(.*)/css/(.*)$ index.php/$0/views/css/$1 [PT,L]
</IfModule>
Beware that the last two redirect everything that contains /css/ in the path.
edit:1: It is considered best practice in CI (from what I've read), to set a static directory on your root like this:
/ .../static ......./css ......./js .../application ......./controller .../...
So that you can simply use /static/css/file.css inline in your views. Also see these resources if they can help:
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki