Welcome Guest, Not a member yet? Register   Sign In
CSS in trouble
#1

[eluser]Alexander Aen[/eluser]
Hi there! I'm new in CI, so I need help. Here is a problem:
1) I created a .htaccess file to load css file, as it was written in user guide
2) it work well locally, but on real server it doesn't work properly. Any browser see a css file, but doesn't display it. I think problem is a sub-domain of my site. If you want, you can see this on Test.
3) base_url() set up correctly.
Sorry for my english. I hope you're understand me and can help me.
#2

[eluser]nevsie[/eluser]
i might be wrong... but your first css is working, but your second one is not?
in the first link you have a CSS folder???
in the second on you do not??? is that correct?

Code:
<link href="http://test.pir.by/css/common.css" rel="stylesheet" type="text/css" />
<link href="http://test.pir.by/galleria.css" rel="stylesheet" type="text/css" media="screen">

secondly why are you using a .htaccess to do anything with your CSS??? your just loading a file, so no sure why the .htaccess would affect this???

do you mean that you using a .htaccess to remove the index.php and your wondering if this is affecting your CSS? if so i do not believe this is the case, justa typo in the CSS URL?
#3

[eluser]Alexander Aen[/eluser]
I'm using .htaccess, cause it was written here: http://codeigniter.com/wiki/css/
If i tried to load css, not using .htaccess, it was no result for other views, except my main view.
The second css is invalid, I've already deleted this link.
So, do you think, that just a link to css without using a .htaccess file can help? But if it doesn't work, what must I do?
#4

[eluser]nevsie[/eluser]
HI and lets see if i can help!

1. I Understand that your .htaccess is in place to remove the index.php part of the URL. And that you have (as per the wiki) added the CSS folder to allow for files to be loaded from this location.

2. For me you first CSS style sheet is working: http://test.pir.by/css/common.css
This file does load and does alter your layout.

3. You second style sheet: http://test.pir.by/galleria.css
does not load as it has the wrong URL - it should be: http://test.pir.by/css/galleria.css
but this is not the problem here as this style sheet does not affect the layout.

4. baseurl() is working as your full URL is displaying and this is correct.


Therefore - what are you expecting to see that you are not currently seeing? You style sheet is loading and working for me!
However, i am not seeing many if any background images - for example:
background: url(../img/top_navi_left.png); does not display.

now my guess here is that either those images are not uploaded???
or that you have not added |img| to your htaccess rule like you did for you css folder. therefore the htaccess is blocking access to the images too???

i imagine you will need something like the below - note the added img and css reference:

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt|css|img)
RewriteRule ^(.*)$ /index.php/$1 [L]

if not... post a copy of what you do have in your htaccess file and we'll see if that helps...

otherwise... check your image references in your style sheet are correct to folder location.
#5

[eluser]ascotan[/eluser]
There are 2 separate issues here.

The CSS file does not need a .htaccess or a rewrite rule to work. The page you linked tells you to use the base_url() function in your "href" link so that you can change the base url of your site in the CI configuration and everything will change automatically:

href='<?=base_url()?>css/reset.css'
instead of
href='http://mywebsite.com/css/reset.css'

The rewrite rule is for hiding parts of the URL. You don't have to rewrite your URLs if you don't want to. It's optional (although cleaner). The rewrite rules are included into the apache configuration.
#6

[eluser]Alexander Aen[/eluser]
Thanks a lot for your help! I just not added |img| to .htaccess file...




Theme © iAndrew 2016 - Forum software by © MyBB