Welcome Guest, Not a member yet? Register   Sign In
cant access stylesheet -is it my paths and config?
#1

[eluser]Ascenti0n[/eluser]
HI all

I have returned to CI after spending many months with Drupal and need to re-acquaint myself with CI fast.

I have taken the applications folder outside the system folder, thus:
Quote:/
application
config
controllers
etc
images
js
styles
mic.css
system
index.php
.htaccess

I have written a simple controller that merely loads a view - this is my view:
Code:
<html>
  <head>
    <title></title>
    <link rel="stylesheet" href="styles/mic.css" type='text/css' media='screen' charset='utf-8' />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

  </head>
  <body>


      <h1>here is an image below</h1>
      <img src="images/sky.jpg"/>

      &lt;?php
        echo base_url();
      ?&gt;


  &lt;/body&gt;
&lt;/html&gt;

here is my htaccess file:

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

The image displays but the href to the stylesheet does not. I even tried changing the style tag to include the base_url
Code:
href="&lt;?php echo base_url();?&gt;styles/mic.css"


My base site url in the config file is set to:

Code:
$config['base_url'] = "http://localhost/mic32/";


I'm certain it's a path issue, but I can't see the wood for the trees, can someone help me with a fresh set of eyes.

Thanks
#2

[eluser]Dam1an[/eluser]
I think you need to add 'styles' to your rewrite condition, so you have
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt|styles)
RewriteRule ^(.*)$ index.php/$1 [L][/quote
#3

[eluser]TheFuzzy0ne[/eluser]
You need to add any directories you want accessible to the list:
Code:
RewriteCond $1 !^(index\.php|images|robots\.txt|styles)

EDIT: RAWR!
#4

[eluser]Ascenti0n[/eluser]
thanks you both very much - that was it - I can now crack on with the good stuff Smile
#5

[eluser]Dam1an[/eluser]
[quote author="TheFuzzy0ne" date="1245169613"]EDIT: RAWR![/quote]

Whats up? Did you get beaten again? Wink

Glad that solved it Smile




Theme © iAndrew 2016 - Forum software by © MyBB