Welcome Guest, Not a member yet? Register   Sign In
Problem Loading CSS
#1

[eluser]edelcal[/eluser]
I'm building a website and I'm having a hard time loading a stylesheet. If I place it within the images folder (which is in the root folder), everything works just fine, but if I create a folder called "styles" or whatever other name and place the css file in it, the page refuses to load the stylesheet, even though the path is 100% correct.

Why does it only work when the stylesheet is inside the images folder but not when it's placed in any other folders? Does it have anything to do with setting permissions or something like that? I don't remember doing anything special with the images folder, but somehow it's the only one that can hold the stylesheet as of right now.

Even funnier, when I place the stylesheet in the root folder, it doesn't work either! I am sure the paths are 100% correct. I have a view called "header" that is loaded in every page, and that's where I set the path for the stylesheet.

Any help would be really appreciated. It's driving me crazy!! Confusednake:
#2

[eluser]tomdelonge[/eluser]
It's probably your .htaccess file. Some of the example files allow stuff from the image folder, otherwise it is routed through the index.php file. Just add a style folder to your list of allowed paths in your .htaccess

Good luck, hope that helps...
#3

[eluser]slowgary[/eluser]
It's almost definitely your .htaccess file. It varies based on server configuration, but my htaccess looks like this:
Code:
Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
#RewriteCond $1 !^(index\.php|cms|assets|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

The !f, !d, !l lines make the rewrite only work when there is not an actual file or directory at that location. This might help for you.

Good luck.
#4

[eluser]edelcal[/eluser]
Thank you so much tomdelonge! It worked. So basically the problem was my htaccess file, which didnt have the styles folder listed. I learned a lot today!
#5

[eluser]edelcal[/eluser]
Thanks slowgary! that was definitely the issue. :-)




Theme © iAndrew 2016 - Forum software by © MyBB