Help needed with css file - Solved |
[eluser]eyalpor[/eluser]
i am new to CI, and have this ongoing problem: CI will not recognize my css file. I searched and tried many posts over the web, but nothing does it. Here is the configuration: I work on localhost, the CI library is "myblog" and it is configured OK in config file. I can see the page, but the css does not apply. Per suggestions on the web, my css file (style.css) is in css/style.css on the root directory : localhost/myblog/css I call the file in header: <link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>css/style.css" media="screen" > which brings the expected outcome: <link rel="stylesheet" type="text/css" href="localhost/myblog/css/style.css" media="screen"> Nada. I have a htaccess file with only "Deny from all" in it under application library. What am I doing wrong?
[eluser]michalsn[/eluser]
Check your main .htaccess file and add "css" directory to allowed items. Code: RewriteCond $1 !^(index\.php|css|robots\.txt)
[eluser]eyalpor[/eluser]
Hello Grad Student, thanks for the reply. My .htaccess file now looks: Deny from all RewriteEngine on RewriteCond $1 !^(index\.php|css|robots\.txt) Nothing. (I am very ignorant about the .htaccess files, so maybe something there is wrong also?)
[eluser]sanir[/eluser]
hi, Please check base URL in config file, it should be http://localhost/myblog/ instead of localhost/myblog/ Thanks, Nasir Ranta
[eluser]Sanjay Sarvaiya[/eluser]
Code: <link rel=“stylesheet” type=“text/css” href=”<?php echo base_url(); ?>css/style.css” media=“screen” > Code: $config['base_url'] = 'localhost/myblog/';
[eluser]eyalpor[/eluser]
Thank you very much guys! The (tiny) problem was indeed the http:// in the beginning of the base_url config. Yet another reminder of why to choose PHP - great community. |
Welcome Guest, Not a member yet? Register Sign In |