htaccess causes loss of stylesheet

For some reason when I try to use the CI Guide version of an .htaccess to remove 'index.php' from my urls I lose all reference to my style sheet in my views:

from my template:
<link href="<?=base_url()?>files/css/default.css" rel="stylesheet" type="text/css" />

I do not have 'index.php' in the base url config, as I missing something here?


You gotta add your "files" dir to your .htaccess, like so:

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

[eluser]Elliot Haughin[/eluser]
Try using this one instead...

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]

It basically says, if the file doesn't exist, then hit index.php/

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

The above htaccess allow access only to "index.php", "robots.txt" and the folders "css", "images", "files" and "scripts". It is more secure this way, because nobody will have direct access to the "system" folder. You can add how many directories you want in the list, but do not add directories where you have PHP files.

Hmmm... Now, I'm getting a 500 Internal Service Error when using any of the above suggestions except Elliot's, which I land on the index page with no url segments, but then get the 500 Internal Service Error when I try to get to any other pages.

This is my first attempt at using htaccess for rewriting urls, so I appreciate your guys' help!


[eluser]Edemilson Lima[/eluser]
My example above works fine with my provider. Maybe your host needs something different. Below are some links with tutorials about the htaccess, may you find them interesting.

I have mod_rewrite working just fine but now I need a type of 'splash' page - something I'd normally avoid but in this occasion it's right for the job. The client also requires that this page is and not something I could easily set up via a redirect eg

If I remove my .htaccess rewrite I can make this happen easily by placing an index.html (which is looked for first) alongside my index.php. But as soon as I add my normal .htaccess file, the base url finds my codeigniter inital page not my splash page

I have tried this, in hope that would again find index.html in preference over index.php but it still finds my codeigniter page.
RewriteEngine On

RewriteCond $1 !^(index\.php|http://www\.example\.com|index.html|images|css|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

I hope what I'm looking for is clear enough. Thanks.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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