lundi 1 décembre 2014

How to always serve fresh minified dynamic CSS/JS files? PHP


I am working on joomla compression plugin that is serving cached CSS and JS files. It is working as intended http://ift.tt/1B6YekG


but few site speed tests are downgrading the performance because I use


cached_file_hash.php?v=123


Reason I use it is to make sure fresh file is served if there was change to any logged files. If there was a change


version changes with



// Version files
private function versionFiles($file){

$version = hash("crc32b",filemtime($file));
return '?v='.$version;

}


So the testers reply with, Resources with a "?" in the URL are not cached....


Here is the test http://ift.tt/1rPVlfF


My first thought was unicode the ?v= which comes to



%3Fv%3D


Well that fails with 403 forbidden ( I might be missing something here. Joomla? ) http://ift.tt/1B6YekI


Maybe a small change is needed in my gzip snipp in order to serve fresh file and not use ?v= in url http://ift.tt/1rPVlfH


Any toughs are appreciated.





Aucun commentaire:

Enregistrer un commentaire