CodeIgniter Forums

Full Version: Cannot load stylesheet
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi there,

I'm new to Codeigniter.  I'm having trouble loading my stylesheet.  No matter what I try I keep getting a 404 file not found.

In the header template between <head> I have tried the following:

<?php echo link_tag('assets/css/styles.css'); ?>

Which out puts:

<link href="http://ci_news.local/assets/css/styles.css" rel="stylesheet" type="text/css" />

And I have tried:

<link rel="stylesheet" href="<?php echo base_url("assets/css/styles.css"); ?>">

Which out puts:

<link rel="stylesheet" href="http://ci_news.local/assets/css/styles.css">

Neither method works. I am loading the helpers correctly.  I am using Xampp on Win7 with virtual hosts.  I have folder called 'ci_news' in my htdocs folder. I can browse to 'http://ci_news.local' to load my project.

The 'assets' folder is located in the root of my project in the same location as the 'application', 'system' and 'user_guide' folders.

My .htaccess file looks like this:

RewriteEngine on

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

RewriteRule ^(.*)$ /index.php/$1 [L]

My routes are the following:

$route['news/create'] = 'news/create';

$route['news/(:any)'] = 'news/view/$1';

$route['news'] = 'news';

$route['(:any)'] = 'pages/view/$1';

$route['default_controller'] = 'pages/view';

Any idea what I'm missing? Thanks a lot guys.