views:

24

answers:

1

in my .htaccess i've got these lines:

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

i tried to include js files with this line:

<script type="text/javascript" src="system/application/media/js/jquery/jquery.js"></script>

but it doesnt work since the rules dont let it pass. it works when i turn the rewrite engine off.

how can i change the rules so it allows url with a /js, /css and /img?

thanks

+1  A: 

At another RewriteCond after your first one that will prevent your RewriteRule from matching. I sometimes filter on specific file extensions for static content files using the following rule:

RewriteCond $1 !\.(js|ico|gif|jpg|png|css|html|swf|mp3|wav|txt)$

If you want to do it based on directory, then you'll want something more like this:

RewriteCond $1 !^(css|js|img)/

Put one of those before your existing RewriteCond and you should be good to go.

zombat
thanks! it worked great! i find all these rules so cryptic. good to have it working right away so i can give it some time later to understand them.
never_had_a_name