• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Codeigniter + CSS not working well, possible baseurl

This question has been asked several times, but I researched and still can't solve it. In one of my view file, I have (referencing to my css):

link rel="stylesheet" type="text/css" href="/application/views/screen.css"
The css file is in:

- www
- application
- view
- css
- screen.css
- system
I also tried to setup the css in the same folder under -www and use it directly by
- www
- application
- view
- css
- screen.css
- system
link rel="stylesheet" type="text/css" href="css/screen.css"
link rel="stylesheet" type="text/css" href="/css/screen.css"
both doesn't work
My base url is set to "" because I develop locally. Is this the issue? I'm Using wamp server.

Typically, I create an "assets" directory for files that need to be accessed.


the rule of thumb is usually that all file references are based upon the index.php file. In theory, this means you would access an image via "assets/images/imageName.jpg"

When I am building stylesheet and javascript links, I usually do the following:

<link rel="stylesheet" type="text/css" href="<?=base_url()?>assets/styles/style.css" />

Never had any problems with it when I do it this way.

You might also consider setting up for multiple environments. Have your base url set one way for development and another for production. http://ellislab.com/codeigniter/user-gui...ments.html

The application folder has an .htaccess in it that denies any HTTP requests to that folder. As apodner recommended, your static assets work better in their own directory.

Are you using .htaccess (to remove index.php) on your webroot?

go to the site www.w3schools.com its really helpful

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.