I am working in my first CodeIgniter project…
After building most of my PHP and start playing with the almost finished scrip I realized that all access to application/views/ folder is denied by the .htaccess.
This is a huge problem for my file structure when I want to access page-specific JavaScript, Images or any web-resource folder. Since all my views template assumes that the file is used locally (That being Page_name/images/cutedog.jpg, in my code more precisely <img src="{images}cutedog.jpg">).
The solution that I found is modifying the .htacces so that it filters out all media files and it allows access to my application folder. But then by doing that I would reveal my file structure which I would rather avoid.
I know what I could just place my web resources outside my application folder and that would solve the problem. But for maintainability purposes I think it would be more logic to have everything as it is right now.
So my question is at follows… What work around would you suggests so that:
– I can maintain my web resources at application/views/issue/WEB_PAGE/Web-resource-folder
– keep my file structure hidden
– web-resources can be accessed
my .htaccess
Deny from all
<FilesMatch "\.(css|js|jpg|pdf|avi|mpg|robots\.txt|png|pdf|favicon\.ico)$">
Order allow,deny
Allow from all
</FilesMatch>
My file structure:
-+ /application/
|
|-+ /Typical CI folders/
|-+ /view/
|-+ /issue/
|-+ /1/
|-+ /page1/
|-+ /img/
|-+ /js/
|-+ /video/
|-+ /page2/
|-+ /img/
|-+ /js/
|-+ /video/
You will need to write complicated rewrite rules for that which will tell .htaccess something like:
If you ask me that is going to become more and more cumbersome as you create more resources. Like you suggested you should place your web resources outside your application folder.
My CI Structure always looks like this: