Welcome Guest, Not a member yet? Register   Sign In
The .htaccess file in application folder gave me lots of trouble
#1

[eluser]CARP[/eluser]
Hi
I've started a new ci project
I copied a template to views folder and started having some problems trying to get the css files

I started trying with chmod, chown, and httpd.conf configurations but could not resolve the issue.
I went through a 403 error I was getting at apache error.log "client denied by server configuration:"

Tried lots of stuff until I decided to rename the .htaccess file in myapp/system but got nothing

Finally, when renamed the application/.htaccess file, it worked!

Whats the problem with the application/.htaccess file that makes apache not to be able to access files like:
/application/views/tpl/css/main.css ?

Any way to fix this and maintain codeigniter's security?
Thanks
#2

[eluser]Massaki[/eluser]
All the files inside the 'application' subfolders are inaccessible by default.
You could transfer all CSS and JS to the same level of 'application' folder.

You can create some exceptions in .htaccess, but it is not recommended, because exposes your application's directory tree.
#3

[eluser]CARP[/eluser]
[quote author="Massaki" date="1398340461"]You could transfer all CSS and JS to the same level of 'application' folder.[/quote]

Wow, never tried that. I'll try to implement it
Thanks a lot for the info!
#4

[eluser]CroNiX[/eluser]
You never want people to be able to directly access anything via the URL in the /application or /system directories, which is why those .htaccess files "denying all" exist in those 2 directories.

You'd want something like:
Code:
/public_html
--/system
--/application
--/assets
----/images
----/css
----/js
--index.php
--.htaccess

Then in the HEAD section
Code:
<style type="text/css">
@import url("/assets/css/your_css.css");
</style>
<skript src="/assets/js/your_js.js" type="text/javascript" charset="utf-8"></skript>
or in the body
Code:
<img src="/assets/images/your_image.png" alt="My awesome image" />
#5

[eluser]CARP[/eluser]
That's perfect!
Thanks for the clarification @CroNiX
#6

[eluser]InsiteFX[/eluser]
Make sure that when you go on a live server that you chmod your index.php to 0644
#7

[eluser]CARP[/eluser]
[quote author="InsiteFX" date="1398382143"]Make sure that when you go on a live server that you chmod your index.php to 0644
[/quote]

Great. Thanks @InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB