Welcome Guest, Not a member yet? Register   Sign In
.htaccess trouble with CodeIgniter 2.0
#1

[eluser]CARP[/eluser]
hi fellas
I've installed CodeIgniter 2.0 (last final release) and begun developing my app.
All went fine until I noticed my main view was not seeing well and wast not loading the css/img files.

I fought with chown and permissions for www-data/apache in my Ubuntu, until I noticed a .htaccess file in /applications folder

When I opened this file, I noticed this line:

Quote:Deny from all

Removed it, and all went great.

1) What's the purpose of that file?
2) Removing that line could mean some security risks in my app?
2.1) If the file is not recommended to be removed, how could I solve the previous trouble?

Thanks
#2

[eluser]Twisted1919[/eluser]
Pointing to images/css/js within the app folder is not the best idea (though is not something bad).
Usually, you would create a js/css/images folder in the root of your app(near app and sys folders) and load the resources from there.

But, removing that .htaccess from the app folder doesn't cause any damage, as long as your files have a
Code:
<?php if( ! defined('BASEPATH')) exit('No direct script access allowed');?>
so that if the file is directly accessed it will stop the execution, then you are safe.
#3

[eluser]CARP[/eluser]
Hi Twisted1919
Maybe I expressed badly

I have a file:

Quote:applications/views/main_view.php

from that file, I include with php the css files, images, which are located in

Quote:applications/views/img
applications/views/css
And having the .htaccess file in /application makes apache load the website without images and css. Thanks for the suggestion
#4

[eluser]Twisted1919[/eluser]
yes, i know what you meant, and my answer stands for your question .
When i suggested to put that php line of code, i assume you understand that it was meant for the php files within your app(views/libraries/helpers etc).

So you can continue just like you are doing now(without htaccess in app folder) but don't forget in your php files, at the start, to add the line i suggested.




Theme © iAndrew 2016 - Forum software by © MyBB