I have a problem, I have to gzip a prototype Lib, but i totaly have no idea how to do this, where to start and how does it works. :)
I find some tutorials but that wasn't helpful...
So I have a folder with my JS Files:
/compressed/js/ 1.js 2.js 3.js
I'm calling these files for a test in this file
/compresses/index.php
<link rel="javascript" type="text/js" href="js/tabs.js" />
<link rel="javascript" type="text/js" href="js/fb.js" />
So what do I have to do? :)
I above example similar to this worked great but didn't compress javascript. I needed to add application/javascript.
Hi If you are using Nginx server the above will not help. Please edit the with command
vi /etc/nginx/nginx.conf
and add the below lines.Restart the nginx with command
/etc/init.d/nginx reload
. It will compress the JS and CSS files.add this code to your .htaccess it will gzip all your css and js files.
Perhaps you should look at the mod_deflate module for Apache: http://httpd.apache.org/docs/2.0/mod/mod_deflate.html
You need to handle this stuff using the configuration for HTTP server that you are using.
Could you please tell me which server you are using ? IIS/Apache ?
Following is link for compression with the IIS
You can use apache's mod_deflate to automatically compress your files on the fly.
Example:
[edit]
To check if your apache server has already output compression enabled, put the example above into an .htaccess file. Then load an html or js file via the server and check the headers for "Content-Encoding", if it says gzip or deflate, it is enabled.