Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hey guys, bit of a mod_rewrite noob, I've got:

RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1

Which I believe says "If the file or directory doesn't exist, pass the request to index.php". I'd like another line which says "If it's a .jpg, .css, .js - don't pass it to index.php". Any help appreciated.

Thanks :)

share|improve this question
up vote 1 down vote accepted

Change the 'RewriteRule' line to:

RewriteRule !\.(jpg|css|js|gif|png)$ index.php
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.