• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problems With CSS and Images

Hello everyone,

I'm hoping someone can see where I'm going wrong here. I'm using the following code in my .htaccess file (I have tried as many versions as I can find). I have cleared index.php out of the config file and set the uri_protocol to AUTO.

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

My homepage loads up properly. However when I access other controllers (ex. "domain.com/members/login") it acts as if it is actually in a "/members/login" directory and therefor cannot find my css and image files which are located at domain.com/css and domain.com/images. I can access those files directly so I don't think it's a permission issue. I am using shared hosting with network solutions.

Please help!?!

Please show your views code, and explain where css and image path you placed.

Check CSS or image url directly.

# check file exist

Here is the CSS link in the "header_view.php" file (stored in application/views)

<link rel="stylesheet" href="css/style.css" />

Here is an example of an image

<img src="images/logo.png" alt="{page_title}" />

they are located at domain.com/css/style.css and domain.com/images/logo.png. Both work on the main view but not through other controllers. Is this an html problem?

please modified your .htaccess as follows

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

please show the config value (stored in application/config/)


try the following code:
&lt;link rel="stylesheet" href="/css/style.css" /&gt;
<img src="/images/logo.png" alt="{page_title}" />


It works...

I just wanna cry...

Thanks for your help!

what i did was put my css, images and js in an inc folder in the root and use .htaccess similar to what appleboy posted above, except i changed this line:

RewriteCond $1 !^(index\.php|css|images|robots\.txt)


RewriteCond $1 !^(index\.php|inc|robots\.txt)

makes for cleaner file structure imo.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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