You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
paulocr edited this page Sep 18, 2014
·
8 revisions
Category:Help::TipsAndTricks | Category:Help::CSS
When using CSS in your site it is usually best to place all CSS code in separate files and include them using a link in your head tag.
With Code Igniter if you are using the apache mod_rewrite rule to remove the index.php file from your urls you need to change the rule to allow any linked css files to be loaded. By default the rule will re-direct any url that does not include the text "index.php", "images", or "robots.txt" to your default controller.
Default rule.
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
Modified rule to allow loading css files.
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt|css)
RewriteRule ^(.*)$ /index.php/$1 [L]
To make for more portable code use the url helper class to link your css file.