Forum Moderators: phranque
RewriteEngine On
RewriteCond %{REQUEST_URI}![^\.css]+$
RewriteRule $ /cgi-bin/script.cgi/ [L]
I have tried just the rewrite rule by itself and it works.
Can someone help me with getting this rewrite condition correct?
Welcome to WebmasterWorld [webmasterworld.com]!
The [] characters enclose a list of characters, any one of which is an acceptable match. That is, [abc] means match a character which is equal to a, b, or c. Preceding this list of characters with "^" means NOT, so [^abc] would mean "Match any character except a, b, or c. Neither of these is what you want to do, so try:
RewriteCond %{REQUEST_URI} !\.css$
RewriteCond %{REQUEST_URI} !\.(css¦inc¦js)$
Note that posting on this board changes solid pipe characters to broken pipe "¦" characters. You must edit the code and change them back before attemping to use the code.
See the link to a regular expressions tutorial in our Apache forum charter [webmasterworld.com] for more info on mod_rewrite patterns.
Jim