Hi everyone,
I'm trying to move one of my sites from Apache to Cherokee. I've nearly
got it working but I'm stuck on one of the rewrite rules. The directory
js/combined has a .htaccess file containing:
ExpiresActive on
ExpiresDefault "access plus 1 month"
RewriteEngine on
# Rewrite non-existent URLs to the combiner, to create a new combined file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (\d+).js combine.php?set=site&v=$1 [L]
I use this for "lazy JavaScript minification". Basically, when a user hits
/js/combined/123.js and 123.js doesn't exist yet, it goes through the
combine.php script. The combine.php script combines and minifies all the
JavaScript files used by the site, outputs them to the correct file name
(123.js) and then serves the file itself. After this is done, every user
gets the file directly (as it now exists). I've got a deployment script
that deploys the site and increments the "version number" used in the JS
URLs. it seems to be working quite well on Apache.
However, on Cherokee I can't get it working. I've tried the following rules:
1. Extension php - FastCGI, Non-final, cache turned off
2. Directory /js/combined AND File Exists - List & Send, gzip, IO cache
turned off (for debugging), Final
3. Directory /js/combined - Rewrite, Final
- Internal, (\d+).js$ to /js/combined/combine.php?set=site&v=$1
In theory the "file exists" rule should serve the existing files, as it's
marked as "final". However this isn't happening and every request is going
through the combine.php script.
I've tried the following rules with the same result:
1. Extension php - FastCGI, Non-final, cache turned off
2. Directory /js/combined AND NOT File Exists - Rewrite, Final, IO cache
turned off (for debugging)
- Internal, (\d+).js$ to /js/combined/combine.php?set=site&v=$1
3. Directory /js/combined - List & Send, gzip, Final
In this case, every file still seems to be going through the combine.php
script as well!? In either scenario, turning off the rewrite serves
existing files correctly, but obviously non-existent URLs don't work.
tl,dr: I want to rewrite a URL in a directory only when the file doesn't
exist, but am having issues with that.
Any suggestions?
--
Regards,
Daniel Lo Nigro
http://dan.cx/ | http://twitter.com/Daniel15
I'm trying to move one of my sites from Apache to Cherokee. I've nearly
got it working but I'm stuck on one of the rewrite rules. The directory
js/combined has a .htaccess file containing:
ExpiresActive on
ExpiresDefault "access plus 1 month"
RewriteEngine on
# Rewrite non-existent URLs to the combiner, to create a new combined file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (\d+).js combine.php?set=site&v=$1 [L]
I use this for "lazy JavaScript minification". Basically, when a user hits
/js/combined/123.js and 123.js doesn't exist yet, it goes through the
combine.php script. The combine.php script combines and minifies all the
JavaScript files used by the site, outputs them to the correct file name
(123.js) and then serves the file itself. After this is done, every user
gets the file directly (as it now exists). I've got a deployment script
that deploys the site and increments the "version number" used in the JS
URLs. it seems to be working quite well on Apache.
However, on Cherokee I can't get it working. I've tried the following rules:
1. Extension php - FastCGI, Non-final, cache turned off
2. Directory /js/combined AND File Exists - List & Send, gzip, IO cache
turned off (for debugging), Final
3. Directory /js/combined - Rewrite, Final
- Internal, (\d+).js$ to /js/combined/combine.php?set=site&v=$1
In theory the "file exists" rule should serve the existing files, as it's
marked as "final". However this isn't happening and every request is going
through the combine.php script.
I've tried the following rules with the same result:
1. Extension php - FastCGI, Non-final, cache turned off
2. Directory /js/combined AND NOT File Exists - Rewrite, Final, IO cache
turned off (for debugging)
- Internal, (\d+).js$ to /js/combined/combine.php?set=site&v=$1
3. Directory /js/combined - List & Send, gzip, Final
In this case, every file still seems to be going through the combine.php
script as well!? In either scenario, turning off the rewrite serves
existing files correctly, but obviously non-existent URLs don't work.
tl,dr: I want to rewrite a URL in a directory only when the file doesn't
exist, but am having issues with that.
Any suggestions?
--
Regards,
Daniel Lo Nigro
http://dan.cx/ | http://twitter.com/Daniel15