2

Why I can't include anything from views if it is inside application folder?

It is fine when I include in main dir:

This works:

<link rel="stylesheet" type="text/css" href="{ci_base_url}css/site.css" /> 

but this does not work:

<link rel="stylesheet" type="text/css" href="{ci_base_url}application/css/site.css" />

Why??

Thanks in advance

1 Answer 1

6

Only the content in what you called the "main dir" is directly accessible via http requests. That's for security reasons. Often that dir is named "public"

Sign up to request clarification or add additional context in comments.

2 Comments

so how to include css file in app folder? I would like to keep my css for each layout like: views/default/css
I find it easier to have all my jquery, images, css and other items stored up in public, and some up above the root for security. But I never really knew the reason you couldnt access them in the views. Thanks Riccardo

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.