tags:

views:

248

answers:

1

Currently what I have in my .htaccess file is this,

RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}.gz -f
RewriteRule ^(.*).(css|js)$ /$1.$2.gz

My CSS and Javascript files have a number next to them such as example01.css and whenever I update them, I increase the number. Each time I do, I also have to update my head.php file to include the new updated file in the page. I also add a "c" to a file when I compress it with YUI compressor. Then I compress it with 7-zip into gzip format because my server does not support deflate, even though it says it does.

My question is, how do I write my .htaccess file so that I give it example.css and it checks if example01.css exists, then checks example02.css, until it finds the latest one, then checks if example02c.css exist, and then finally example02.css.gz?

I've also considered using Minify but I forgot why I decided against it.

A: 

htaccess has very limited abilities; there are no increment or decrement functions, and the only way to get a "loop" is through inefficient sets of redirects.

You could try using a RewriteMap to call a script to do these checks for you instead.

Gabriel Hurley
oh i see. no biggie then.
this is a dead end