sors Posted February 10, 2011 Share Posted February 10, 2011 This modification for combined js and css files statical compression. The source files are compressed with maximum compression and replace original files in cache directory with source files are located in cache directory with nogzip extension..htaccess rules give the compressed files with gzip headers and none compressed for old browser.In classes\Tools.php replace file_put_contents($compressed_js_path, $content); chmod($compressed_js_path, 0777); With file_put_contents($compressed_js_path.'.nogzip', $content); chmod($compressed_js_path.'.nogzip', 0777); $c = @gzencode($content, 9, FORCE_GZIP); if (!empty($c)) { file_put_contents($compressed_js_path, $c); chmod($compressed_js_path, 0777); } replace file_put_contents($cache_filename, $content); chmod($cache_filename, 0777); With file_put_contents($cache_filename.'.nogzip', $content); chmod($cache_filename.'.nogzip', 0777); $c = @gzencode($content, 9, FORCE_GZIP); if (!empty($c)) { file_put_contents($cache_filename, $c); chmod($cache_filename, 0777); } Add to .htaccess RewriteEngine On #redirect for Konqueror and old browsers RewriteCond %{HTTP:Accept-encoding} !gzip [OR] RewriteCond %{HTTP_USER_AGENT} Konqueror RewriteRule ^(.*)\.(css|js)$ $1.nogzip.$2 [QSA,L] Header append Vary User-Agent #set Content-Encoding for css/js files Header set Content-Encoding: gzip Header set Cache-control: private #reset Content-Encoding if nogzip Header unset Content-Encoding Link to comment Share on other sites More sharing options...
Rhobur Posted February 15, 2011 Share Posted February 15, 2011 I'm using 1.3.2 and none of the above fits, don't have any file_put method in there. any ideas ? Link to comment Share on other sites More sharing options...
sors Posted February 16, 2011 Author Share Posted February 16, 2011 This code only CCC function in sprestashop 1.4 Link to comment Share on other sites More sharing options...
DATO Posted February 20, 2011 Share Posted February 20, 2011 thx for share, how can we put this feature to 1.3? Link to comment Share on other sites More sharing options...
sors Posted February 20, 2011 Author Share Posted February 20, 2011 For 1.3 you can manually compress js and css files and add code to .htaccessangora, I submit request now/ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now