I am working on my first codeigniter project and am trying to put my styling in an assets folder, as it looks like that is best practice. I have tried to set it up the way others have but something is not working! Any help appreciated.
My file structure:
application
assets->css->style.css
I made a helper application/helpers.utlity_helper.php which contains the following:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
if ( ! function_exists('asset_url()'))
{
function asset_url()
{
return site_url().'assets/';
}
}
I set it to autoload:
$autoload['helper'] = array('url','form', 'utility');
My .htcaccess file:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|assets|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
My routes.php file has:
$route['assets/(:any)']='assets/$1';
And finally, in my header I have:
<link rel="stylesheet" type="text/css" href="<?php echo asset_url();?>css/style.css">
But the styles in my style file are not showing up! Please let me know if you see an error or if you know why this is. Thank you!