PDA

View Full Version : .htaccess RewriteCond for specific file types


jussa
08-25-2009, 04:05 AM
Hey all,

At the moment, I have a rewrite rule, much like drupals, where the path is added as a querystring to index.php

What I would like to do, is create a rule so that things like CSS, img, js etc (basically any files that DONT have .php, .inc extensions), to be redirected.

so, lets say I have /subfolder/file.php and /subfolder/style.css

How do I make /subfolder/file.php be rewrote as /index.php?path=/subfolder/file.php (I already have this enabled, so no need to get regex for that)

and have /style.css automatically rewrite to /subfolder/style.css

basically, for non-script files, I want it to do the redirect...

Cheers

ess
08-28-2009, 10:00 PM
I have not tested this...so, please do check

RewriteRule .(gif|jpg|jpeg)$ nonscripts.php [NC,R]

this should direct all gif, jpg, etc. to nonscripts.php

cheers
~E